Comments (4)
Do you have a failing test case I can try?
from go-coap.
80 2 122 35 177 69 15 11 115 112 97 114 107 47 99 99 51 48 48 48 45 112 97 116 99 104 45 118 101 114 115 105 111 110 255 49 46 50 56
This are the bytes (received from Spark Core). ;-)
I think any valid message with token will do. It's not visible as long as one Marshal and Unmarshal using go-coap. But I deal with multilanguage system and this is how I've spot a problem.
Please compare:
http://tools.ietf.org/html/draft-ietf-core-coap-10#section-3
and
http://tools.ietf.org/html/rfc7252#section-3
The UnmarshalBinary reads tokenLen but never really reads the token:
https://github.com/dustin/go-coap/blob/master/message.go#L452
Somewhere after the line 455 you should add:
m.Token = make([]byte, tokenLen)
copy(m.Token, data[4:4+tokenLen])
b := data[4+tokenLen:]
I've also checked and the option parsing implements an old version of RFC.
BTW thanks for a library 👍
from go-coap.
I've integrated other's changes into my branch of your code. I've also fixed a memory leak. Unfortunately, the test are broken for now.
If you care, my repo is here, please consider pulling it: https://github.com/orian/go-coap
from go-coap.
The difference in parsing that data between what I've already got and your example seems negligible:
Before:
coap.Message{Type:0x1, Code:0x2, MessageID:0x7a23, Token:[]uint8(nil), Payload:[]uint8{0x31, 0x2e, 0x32, 0x38}, opts:coap.options{coap.option{ID:0xb, Value:"E"}, coap.option{ID:0xb, Value:"spark/cc3000-patch-version"}}}
After:
coap.Message{Type:0x1, Code:0x2, MessageID:0x7a23, Token:[]uint8{}, Payload:[]uint8{0x31, 0x2e, 0x32, 0x38}, opts:coap.options{coap.option{ID:0xb, Value:"E"}, coap.option{ID:0xb, Value:"spark/cc3000-patch-version"}}}
Do you have an example that uses tokens?
I'm open to bringing in your changes, but they're not quite done in the style I'm used to. i.e. merges, fixes, etc… How do you feel about an am+cleanup import of the changes? Authors keep their names, but merges and fixups would be removed.
from go-coap.
Related Issues (20)
- Implement BinaryMarshaler and BinaryUnmarshaler for Message
- panic occured! HOT 4
- Implement message retransmission of CON messages HOT 2
- TCP CoAP support
- Unit tests failing HOT 3
- Implement CoAP Blockwise Transfers HOT 4
- DTLS Support HOT 4
- Websocket Transport HOT 3
- what about block HOT 2
- coap.ParseMessage is private
- How to define Resources or Endpoints on ServerSide? HOT 3
- Data From go-coap client is not reaching Java coap-californium server HOT 3
- Implement observe draft
- coap.ServeMux does not support root path ("/") handler
- How to Handle URL Parametrs
- ResponseTimeout is not configurable on per message basis HOT 5
- Example server type assertion doesn't work, causes example to not work HOT 5
- Ridiculously low, hard-coded response timeout HOT 1
- Can anyone help manage the pull requests here? HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from go-coap.