CoAP Client/Server implementing RFC 7252 for the Go Language

Related tags

Network canopus
Overview

Canopus

GoDoc Build Status Coverage Status Go Report Card

Canopus is a client/server implementation of the Constrained Application Protocol (CoAP)

Updates

25.11.2016

I've added basic dTLS Support based on [Julien Vermillard's][JVERMILLARD] [implementation][NATIVEDTLS]. Thanks Julien! It should now support PSK-based authentication. I've also gone ahead and refactored the APIs to make it that bit more Go idiomatic. [JVERMILLARD]: https://github.com/jvermillard [NATIVEDTLS]: https://github.com/jvermillard/nativedtls

Building and running

  1. git submodule update --init --recursive
  2. cd openssl
  3. ./config && make
  4. You should then be able to run the examples in the /examples folder

Simple Example

	// Server
	// See /examples/simple/server/main.go
	server := canopus.NewServer()

	server.Get("/hello", func(req canopus.Request) canopus.Response {
		msg := canopus.ContentMessage(req.GetMessage().GetMessageId(), canopus.MessageAcknowledgment)
		msg.SetStringPayload("Acknowledged: " + req.GetMessage().GetPayload().String())

		res := canopus.NewResponse(msg, nil)
		return res
	})

	server.ListenAndServe(":5683")

	// Client
	// See /examples/simple/client/main.go
	conn, err := canopus.Dial("localhost:5683")
	if err != nil {
		panic(err.Error())
	}

	req := canopus.NewRequest(canopus.MessageConfirmable, canopus.Get, canopus.GenerateMessageID()).(*canopus.CoapRequest)
	req.SetStringPayload("Hello, canopus")
	req.SetRequestURI("/hello")

	resp, err := conn.Send(req)
	if err != nil {
		panic(err.Error())
	}

	fmt.Println("Got Response:" + resp.GetMessage().GetPayload().String())

Observe / Notify

	// Server
	// See /examples/observe/server/main.go
	server := canopus.NewServer()
	server.Get("/watch/this", func(req canopus.Request) canopus.Response {
		msg := canopus.NewMessageOfType(canopus.MessageAcknowledgment, req.GetMessage().GetMessageId(), canopus.NewPlainTextPayload("Acknowledged"))
		res := canopus.NewResponse(msg, nil)

		return res
	})

	ticker := time.NewTicker(3 * time.Second)
	go func() {
		for {
			select {
			case <-ticker.C:
				changeVal := strconv.Itoa(rand.Int())
				fmt.Println("[SERVER << ] Change of value -->", changeVal)

				server.NotifyChange("/watch/this", changeVal, false)
			}
		}
	}()

	server.OnObserve(func(resource string, msg canopus.Message) {
		fmt.Println("[SERVER << ] Observe Requested for " + resource)
	})

	server.ListenAndServe(":5683")

	// Client
	// See /examples/observe/client/main.go
	conn, err := canopus.Dial("localhost:5683")

	tok, err := conn.ObserveResource("/watch/this")
	if err != nil {
		panic(err.Error())
	}

	obsChannel := make(chan canopus.ObserveMessage)
	done := make(chan bool)
	go conn.Observe(obsChannel)

	notifyCount := 0
	for {
		select {
		case obsMsg, _ := <-obsChannel:
			if notifyCount == 5 {
				fmt.Println("[CLIENT >> ] Canceling observe after 5 notifications..")
				go conn.CancelObserveResource("watch/this", tok)
				go conn.StopObserve(obsChannel)
				return
			} else {
				notifyCount++
				// msg := obsMsg.Msg\
				resource := obsMsg.GetResource()
				val := obsMsg.GetValue()

				fmt.Println("[CLIENT >> ] Got Change Notification for resource and value: ", notifyCount, resource, val)
			}
		}
	}

dTLS with PSK

	// Server
	// See /examples/dtls/simple-psk/server/main.go
	server := canopus.NewServer()

	server.Get("/hello", func(req canopus.Request) canopus.Response {
		msg := canopus.ContentMessage(req.GetMessage().GetMessageId(), canopus.MessageAcknowledgment)
		msg.SetStringPayload("Acknowledged: " + req.GetMessage().GetPayload().String())
		res := canopus.NewResponse(msg, nil)

		return res
	})

	server.HandlePSK(func(id string) []byte {
		return []byte("secretPSK")
	})

	server.ListenAndServeDTLS(":5684")

	// Client
	// See /examples/dtls/simple-psk/client/main.go
	conn, err := canopus.DialDTLS("localhost:5684", "canopus", "secretPSK")
	if err != nil {
		panic(err.Error())
	}

	req := canopus.NewRequest(canopus.MessageConfirmable, canopus.Get, canopus.GenerateMessageID())
	req.SetStringPayload("Hello, canopus")
	req.SetRequestURI("/hello")

	resp, err := conn.Send(req)
	if err != nil {
		panic(err.Error())
	}

	fmt.Println("Got Response:" + resp.GetMessage().GetPayload().String())

CoAP-CoAP Proxy

	// Server
	// See /examples/proxy/coap/server/main.go
	server := canopus.NewServer()

	server.Get("/proxycall", func(req canopus.Request) canopus.Response {
		msg := canopus.ContentMessage(req.GetMessage().GetMessageId(), canopus.MessageAcknowledgment)
		msg.SetStringPayload("Data from :5685 -- " + req.GetMessage().GetPayload().String())
		res := canopus.NewResponse(msg, nil)

		return res
	})
	server.ListenAndServe(":5685")

	// Proxy Server
	// See /examples/proxy/coap/proxy/main.go
	server := canopus.NewServer()
	server.ProxyOverCoap(true)

	server.Get("/proxycall", func(req canopus.Request) canopus.Response {
		canopus.PrintMessage(req.GetMessage())
		msg := canopus.ContentMessage(req.GetMessage().GetMessageId(), canopus.MessageAcknowledgment)
		msg.SetStringPayload("Acknowledged: " + req.GetMessage().GetPayload().String())
		res := canopus.NewResponse(msg, nil)

		return res
	})
	server.ListenAndServe(":5683")

	// Client
	// See /examples/proxy/coap/client/main.go
	conn, err := canopus.Dial("localhost:5683")
	if err != nil {
		panic(err.Error())
	}

	req := canopus.NewRequest(canopus.MessageConfirmable, canopus.Get, canopus.GenerateMessageID())
	req.SetProxyURI("coap://localhost:5685/proxycall")

	resp, err := conn.Send(req)
	if err != nil {
		println("err", err)
	}
	canopus.PrintMessage(resp.GetMessage())

CoAP-HTTP Proxy

	// Server
	// See /examples/proxy/http/server/main.go
	server := canopus.NewServer()
	server.ProxyOverHttp(true)

	server.ListenAndServe(":5683")

	// Client
	// See /examples/proxy/http/client/main.go
	conn, err := canopus.Dial("localhost:5683")
	if err != nil {
		panic(err.Error())
	}

	req := canopus.NewRequest(canopus.MessageConfirmable, canopus.Get, canopus.GenerateMessageID())
	req.SetProxyURI("https://httpbin.org/get")

	resp, err := conn.Send(req)
	if err != nil {
		println("err", err)
	}
	canopus.PrintMessage(resp.GetMessage())
Comments
  • Token is not set on response

    Token is not set on response

    The output has been modified and does not match currently checked-in code. For example, token is printed using "% x" format.

    Received bytes: 44 01 1a bf 78 6d f2 d7 bb 2e 77 65 6c 6c 2d 6b 6e 6f 77 6e 04 63 6f 72 65 10

    2015/09/23 10:27:23 = = = = = = = = = = = = = = = = 2015/09/23 10:27:23 Code: 1, 1 2015/09/23 10:27:23 Code String: GET 2015/09/23 10:27:23 MessageId: 6847, 1abf 2015/09/23 10:27:23 MessageType: 0, 0 2015/09/23 10:27:23 Token: 78 6d f2 d7 2015/09/23 10:27:23 Token Length: 4 2015/09/23 10:27:23 Payload str: 2015/09/23 10:27:23 Payload hex: 2015/09/23 10:27:23 - - - OPTIONS - - - 2015/09/23 10:27:23 Code/Number: 11 , Name: Uri-Path , Value: .well-known 2015/09/23 10:27:23 Code/Number: 11 , Name: Uri-Path , Value: core 2015/09/23 10:27:23 Code/Number: 12 , Name: Content-Format , Value: 2015/09/23 10:27:23 = = = = = = = = = = = = = = = =

    Library generates response and it is clear that Token is not included. I believe that according to spec section "5.3.2 Request/Response Matching Rules" response token must match request token.

    2015/09/23 10:27:23 = = = = = = = = = = = = = = = = 2015/09/23 10:27:23 Code: 69, 45 2015/09/23 10:27:23 Code String: 205 Content 2015/09/23 10:27:23 MessageId: 6847, 1abf 2015/09/23 10:27:23 MessageType: 2, 2 2015/09/23 10:27:23 Token: 2015/09/23 10:27:23 Token Length: 0 2015/09/23 10:27:23 Payload str: <//hello>,<//hello>,<//basic>,<//basic/json>,<//basic/xml>,<//.well-known/core>, 2015/09/23 10:27:23 Payload hex: 3c 2f 2f 68 65 6c 6c 6f 3e 2c 3c 2f 2f 68 65 6c 6c 6f 3e 2c 3c 2f 2f 62 61 73 69 63 3e 2c 3c 2f 2f 62 61 73 69 63 2f 6a 73 6f 6e 3e 2c 3c 2f 2f 62 61 73 69 63 2f 78 6d 6c 3e 2c 3c 2f 2f 2e 77 65 6c 6c 2d 6b 6e 6f 77 6e 2f 63 6f 72 65 3e 2c 2015/09/23 10:27:23 - - - OPTIONS - - - 2015/09/23 10:27:23 Code/Number: 12 , Name: Content-Format , Value: 40 2015/09/23 10:27:23 = = = = = = = = = = = = = = = = 2015/09/23 10:27:23 Response bytes: 60 45 1a bf c1 28 ff 3c 2f 2f 68 65 6c 6c 6f 3e 2c 3c 2f 2f 68 65 6c 6c 6f 3e 2c 3c 2f 2f 62 61 73 69 63 3e 2c 3c 2f 2f 62 61 73 69 63 2f 6a 73 6f 6e 3e 2c 3c 2f 2f 62 61 73 69 63 2f 78 6d 6c 3e 2c 3c 2f 2f 2e 77 65 6c 6c 2d 6b 6e 6f 77 6e 2f 63 6f 72 65 3e 2c

    opened by kulak 3
  • error looping infinite

    error looping infinite

    i wrote a tiny project as https://github.com/crazydiamondzgy/iot-coap-client-c-sdk, and I test with californium server which is right.

    when I test with canopus simple server, like this

    func main() { server := NewLocalServer()

    server.Post("/v1/appid/1", func(req CoapRequest) CoapResponse {
        log.Println("Hello Called")
        PrintMessage(req.GetMessage())
        msg := ContentMessage(req.GetMessage().MessageId, TYPE_ACKNOWLEDGEMENT)
        msg.SetStringPayload("Acknowledged: " + req.GetMessage().Payload.String())
        res := NewResponse(msg, nil)
    
        return res
    })
    
    server.Start()
    

    }

    the first time, everything is ok, I closed my tool and reopen to test the second time canopus display error looping infinite as below:

    2015/09/18 01:00:47 read udp 0.0.0.0:5683: i/o timeout 2015/09/18 01:00:47 This was a *net.OpError with a Timeout 2015/09/18 01:00:47 read udp 0.0.0.0:5683: i/o timeout 2015/09/18 01:00:47 This was a *net.OpError with a Timeout 2015/09/18 01:00:47 read udp 0.0.0.0:5683: i/o timeout 2015/09/18 01:00:47 This was a *net.OpError with a Timeout 2015/09/18 01:00:47 read udp 0.0.0.0:5683: i/o timeout 2015/09/18 01:00:47 This was a *net.OpError with a Timeout 2015/09/18 01:00:47 read udp 0.0.0.0:5683: i/o timeout 2015/09/18 01:00:47 This was a *net.OpError with a Timeout

    by the way, I change some code like this to display error code

        readBuf := make([]byte, BUF_SIZE)
    for {
        len, addr, err := conn.ReadFromUDP(readBuf)
        if err == nil {
    
            msgBuf := make([]byte, len)
            copy(msgBuf, readBuf)
    
    
            go s.handleMessage(msgBuf, conn, addr)
        } else {
                    switch err := err.(type) {
    
                    case net.Error:
                        if err.Timeout() {
                        log.Println("This was a *net.OpError with a Timeout")
                        }
                    }
    
                    if err != nil {
                        log.Println(err.Error())
                    }
              }
    }
    
    opened by crazydiamondzgy 3
  • calculate blockPayloadStart wrong when send blocks

    calculate blockPayloadStart wrong when send blocks

    if blockSize = 2, blockPayloadStart should be 0, 2, 4, 6 ... but your formulation: blockPayloadStart = currSeq*uint32(blockSize) + (currSeq * 1) will generate 0, 3, 6 ...

    opened by zltl 1
  • DTLS example out of date?

    DTLS example out of date?

    The current DTLS sample uses:

    req := canopus.NewRequest(canopus.MessageConfirmable, canopus.Get, canopus.GenerateMessageID())

    Which gives:

    # command-line-arguments ./client.go:15: too many arguments in call to canopus.NewRequest have (number, canopus.CoapCode, uint16) want (uint8, canopus.CoapCode)

    The "simple" example, which works, has:

    req := canopus.NewRequest(canopus.MessageConfirmable, canopus.Get)

    But updating the dtls example to use the same NewRequest syntax results in: `[signal SIGSEGV: segmentation violation code=0x1 addr=0xe0 pc=0x7f12183f3c1b]

    runtime stack: runtime.throw(0x6c2ccb, 0x2a) /usr/local/go/src/runtime/panic.go:596 +0x95 runtime.sigpanic() /usr/local/go/src/runtime/signal_unix.go:274 +0x2db

    goroutine 1 [syscall, locked to thread]: runtime.cgocall(0x62b660, 0xc420049c58, 0xc420011438) /usr/local/go/src/runtime/cgocall.go:131 +0xe2 fp=0xc420049c28 sp=0xc420049be8 github.com/zubairhamed/canopus._Cfunc_SSL_connect(0x1633c60, 0x0) github.com/zubairhamed/canopus/_obj/_cgo_gotypes.go:379 +0x49 fp=0xc420049c58 sp=0xc420049c28 github.com/zubairhamed/canopus.(*DTLSConnection).connect.func1(0x1633c60, 0x0) /home/ptone/go/src/github.com/zubairhamed/canopus/dtls.go:763 +0x60 fp=0xc420049c90 sp=0xc420049c58 github.com/zubairhamed/canopus.(*DTLSConnection).connect(0xc4200147d0, 0x0, 0x0) /home/ptone/go/src/github.com/zubairhamed/canopus/dtls.go:763 +0x2f fp=0xc420049cc0 sp=0xc420049c90 github.com/zubairhamed/canopus.(*DTLSConnection).Write(0xc4200147d0, 0xc42004c2c0, 0x21, 0x40, 0x40, 0x0, 0x0) /home/ptone/go/src/github.com/zubairhamed/canopus/dtls.go:708 +0xfe fp=0xc420049d10 sp=0xc420049cc0 github.com/zubairhamed/canopus.(*DTLSConnection).sendMessage(0xc4200147d0, 0x9dffe0, 0xc420014820, 0x0, 0xc420049e80, 0x612e50, 0x6840e0) /home/ptone/go/src/github.com/zubairhamed/canopus/dtls.go:674 +0x2a8 fp=0xc420049de0 sp=0xc420049d10 github.com/zubairhamed/canopus.(*DTLSConnection).Send(0xc4200147d0, 0x9defa0, 0xc420017470, 0x7, 0x6b8f42, 0x9, 0x9de600) /home/ptone/go/src/github.com/zubairhamed/canopus/dtls.go:653 +0x5ba fp=0xc420049ec8 sp=0xc420049de0 main.main() /home/ptone/go/src/github.com/zubairhamed/canopus/examples/dtls/simple-psk/client.go:21 +0x128 fp=0xc420049f88 sp=0xc420049ec8 runtime.main() /usr/local/go/src/runtime/proc.go:185 +0x20a fp=0xc420049fe0 sp=0xc420049f88 runtime.goexit() /usr/local/go/src/runtime/asm_amd64.s:2197 +0x1 fp=0xc420049fe8 sp=0xc420049fe0

    goroutine 17 [syscall, locked to thread]: runtime.goexit() /usr/local/go/src/runtime/asm_amd64.s:2197 +0x1`

    opened by ptone 1
  • Issue connecting LWM2M client

    Issue connecting LWM2M client

    I wasn't able to run your LWM2M client example from the betwixt project - the client would connect sucessfully to a LWM2M server, but even the registration message did not get send out successfully.

    I traced this down to an issue in canopus:

    • serveServer() in server.go starts listening to a local socket
    • run_basic_client.go then triggers sending out a registration message via Send()
    • Send() starts listening to another local socket and sends the registration message to the server from there
    • server then responds back to the socket opened by Send(), not the one by serveServer()

    Actually, the LWM2M client should only ever need to listen to one socket. In this branch, I implemented a change where Send() reuses the already opened UDP socket, instead of opening another one: https://github.com/crenz/canopus/commit/6dc7ba1671f3e23c6af4ad05986b5a0a94a77dcc

    Registration now suceeds, and requests are received successfully from Leshan and Wakaama LWM2M servers.

    opened by crenz 1
  • Sending CON messages during the client lifetime

    Sending CON messages during the client lifetime

    When the client has already started, the Send and SendTo functions never return because of the Read inside SendMessageTo. The ACK message from the server is caught instead by the serveServer, not by the Read inside the SendMessageTo.

    opened by tkola 1
  • HTTP-CoAP proxy

    HTTP-CoAP proxy

    • Expose HTTP Proxy Endpoint at root /
    • if Request starts with coap/coaps
    • if not enabled/proxy not allowed, return 5.01
    • if timeout, return 5.04
    • if response not understood, return 5.02
    • cross check allowed coap accept headers allowed - returns 406 not acceptable
    • Methods
      • OPTIONS return 5.01
      • TRACEw return 5.01
      • GET if Success return 2.00 response payload == CoAP Representation resource, Content-Type and Content-Encoding header must be set
        • Include to CoAP Request
          • Accept, Conditional GET
          • If Accept, validate Accept is valid, else return 4.06
      • HEAD
        • Like GET but no message body response
      • POST
        • If the action performed by the POST method does not result in a resource that can be identified by a URI, a 200 (OK) or 204 (No Content) response MUST be returned to the client.
        • If a resource has been created on the origin server, a 201 (Created) response MUST be returned.
        • If CoAP responds with Location-, return to HTTP the Location- Headers
      • PUT, DELETE
      • CONNECT return 5.01
    feature 
    opened by zubairhamed 1
  • Reuse existing connection

    Reuse existing connection

    When sending UDP messages, now reuses the previousy opened local port, rather than opening a new local port to send from.

    Fixes issue https://github.com/zubairhamed/canopus/issues/74 .

    opened by crenz 0
  • Malicious CoAP Messages Causes Server Crashes

    Malicious CoAP Messages Causes Server Crashes

    Hi,

    similarly to bsmelo, I have tried my hands on fuzzy testing CoAP applications for my master's thesis. I used the "simple" example server as a target and managed to produce two different types of fatal errors that caused server crashes.

    These errors were likely caught by bsmelo, and I suspect they have not been fixed as his issue remains open. Please contact me at [email protected] and I will provide you with the server error logs that specifies the location of each error.

    Regards Fredrik

    opened by fliljeda 0
  • does coapServer support query_string-like uri?

    does coapServer support query_string-like uri?

    according to the function: "CreateNewRegExRoute()", it seems like i cannot use uri such like server.Get("/query/string/{mac}?arg1={val} actually, i put info into msgPayload, but it's not standard REST usage that GET method contains payload, it's possible to support that?

    opened by AllenKd 0
  • src/github.com/zubairhamed/canopus/openssl/include/openssl/e_os2.h:13:11: fatal error: openssl/opensslconf.h: No such file or directory

    src/github.com/zubairhamed/canopus/openssl/include/openssl/e_os2.h:13:11: fatal error: openssl/opensslconf.h: No such file or directory

    Hello all,

    i am trying to use canopus but i got the following error:

    # github.com/zubairhamed/canopus In file included from src/github.com/zubairhamed/canopus/openssl/include/openssl/err.h:13, from src/github.com/zubairhamed/canopus/dtls.go:9: src/github.com/zubairhamed/canopus/openssl/include/openssl/e_os2.h:13:11: fatal error: openssl/opensslconf.h: No such file or directory # include <openssl/opensslconf.h> ^~~~~~~~~~~~~~~~~~~~~~~ compilation terminated. make: *** [Makefile:20: deps] Error 2

    on my project i am using this makefile to consume the library:

    export GOPATH := $(PWD)
    export GOBIN := $(GOPATH)/bin
    export PATH := $(PATH):$(GOBIN)
    export CGO_ENABLED := 1
    
    export PRG := edge-node-simulator
    
    all: bin src pkg build
    
    bin:
    	mkdir bin
    
    src: 
    	mkdir src
    
    pkg:
    	mkdir pkg
    
    deps:
    	go get -v github.com/zubairhamed/canopus
    
    build: deps
    	go install src/main/$(PRG).go
    
    .PHONY: build
    
    clean:
    	rm -rf bin
    	rm -rf pkg
    	rm -rf src/github.com
    
    run:
    	go run src/main/$(PRG).go
    
    

    any guidance on how do i get canopus working?

    many thanks in advance

    opened by sombriks 1
  • Not able to run psk client example

    Not able to run psk client example

    I have successfully managed to run the psk server example, but when running the client I get an error in the SSL_connect function in openssl. My environment:

    • gcc version 6.4.0
    • go version go1.10.3 linux/amd64

    I set up the repo according to the readme, and also set LD_LIBRARY_PATH=./openssl before running the examples.

    The complete stacktrace is presented here:

    fatal error: unexpected signal during runtime execution
    [signal SIGSEGV: segmentation violation code=0x1 addr=0xe0 pc=0x7fbebe1e612b]
    
    runtime stack:
    runtime.throw(0x6ca5d8, 0x2a)
    	/usr/local/go/src/runtime/panic.go:616 +0x81
    runtime.sigpanic()
    	/usr/local/go/src/runtime/signal_unix.go:372 +0x28e
    
    goroutine 1 [syscall]:
    runtime.cgocall(0x62b8f0, 0xc42005dc78, 0xe)
    	/usr/local/go/src/runtime/cgocall.go:128 +0x64 fp=0xc42005dc48 sp=0xc42005dc10 pc=0x404d04
    github.com/zubairhamed/canopus._Cfunc_SSL_connect(0xd8bea0, 0x0)
    	_cgo_gotypes.go:379 +0x49 fp=0xc42005dc78 sp=0xc42005dc48 pc=0x620439
    github.com/zubairhamed/canopus.(*DTLSConnection).connect.func1(0xd8bea0, 0xb)
    	/home/franz/PROGRAMMERING/GO/src/github.com/zubairhamed/canopus/dtls.go:763 +0x56 fp=0xc42005dcb0 sp=0xc42005dc78 pc=0x628116
    github.com/zubairhamed/canopus.(*DTLSConnection).connect(0xc420090550, 0x10, 0xc42013e150)
    	/home/franz/PROGRAMMERING/GO/src/github.com/zubairhamed/canopus/dtls.go:763 +0x2f fp=0xc42005dce0 sp=0xc42005dcb0 pc=0x624acf
    github.com/zubairhamed/canopus.(*DTLSConnection).Write(0xc420090550, 0xc42013e170, 0x21, 0x40, 0x40, 0x0, 0x0)
    	/home/franz/PROGRAMMERING/GO/src/github.com/zubairhamed/canopus/dtls.go:708 +0xea fp=0xc42005dd30 sp=0xc42005dce0 pc=0x6247ba
    github.com/zubairhamed/canopus.(*DTLSConnection).sendMessage(0xc420090550, 0x6f6100, 0xc4200905a0, 0x0, 0x687c80, 0x0, 0x0)
    	/home/franz/PROGRAMMERING/GO/src/github.com/zubairhamed/canopus/dtls.go:674 +0x27d fp=0xc42005ddf0 sp=0xc42005dd30 pc=0x62426d
    github.com/zubairhamed/canopus.(*DTLSConnection).Send(0xc420090550, 0x6f5b40, 0xc420027230, 0x7, 0x6c053f, 0x9, 0x6f5400)
    	/home/franz/PROGRAMMERING/GO/src/github.com/zubairhamed/canopus/dtls.go:653 +0x4d4 fp=0xc42005dec8 sp=0xc42005ddf0 pc=0x623e84
    main.main()
    	/home/franz/PROGRAMMERING/GO/src/github.com/zubairhamed/canopus/examples/dtls/simple-psk/client.go:19 +0x128 fp=0xc42005df88 sp=0xc42005dec8 pc=0x62ad98
    runtime.main()
    	/usr/local/go/src/runtime/proc.go:198 +0x212 fp=0xc42005dfe0 sp=0xc42005df88 pc=0x42dc32
    runtime.goexit()
    	/usr/local/go/src/runtime/asm_amd64.s:2361 +0x1 fp=0xc42005dfe8 sp=0xc42005dfe0 pc=0x457a01
    exit status 2
    
    opened by franzwilhelm 4
  • [Potential] Security Vulnerabilities within canopus

    [Potential] Security Vulnerabilities within canopus

    Hello developers of canopus,

    My name is Bruno, and I'm an MSc. student in Brazil within the Institute of Computing from the University of Campinas. As part of my research on the application of fuzzing techniques for robustness and security black-box testing of CoAP implementations, I've tested your library. The sample used in my research was compiled from distribution/commit e374f5b @ 2018-02-07. The application used to test it was examples/server/server.go.

    I'm contacting you because the application mentioned above was one of the samples for which our tool was able to detect robustness and/or security issues. In a broad sense, every failure we found can actually be classified as a security vulnerability, because they impact availability --- the application either aborts or needs forceful restart in order to restore servicing CoAP requests. However, we didn't go as far as performing a thorough root-cause analysis for those failures, since it would be unfeasible for us (more than 100 failures were detected across 25 samples, each one using a different CoAP library, spanning 8 programming languages) and thus out-of-scope of this particular research.

    We think that one of our main contributions is the opportunity to make a real-world impact on IoT security by reporting those failures to CoAP libraries' maintainers, with a comprehensible and easy way to replicate them so developers can further investigate and fix those failures. So, in order to follow up with a responsible disclosure process, we ask for a proper e-mail address (or any other form of contact) so we can send you:

    • A script to reproduce the failures;
    • A pcap file used by the script, containing the packets causing the failures;
    • A logfile with the stacktraces we got for each reported failure.

    We expect a reply anytime soon. Please let us know if which form of contact should we use --- or if it's ok to use this channel.

    Thanks & Regards, Bruno Melo.

    opened by bsmelo 1
  • DTLS only supports a single request

    DTLS only supports a single request

    Only the first request is responded to.

    I've been trying to trace it through the differences between server.handleIncomingDTLSData and server.handleIncomingData

    but without luck

    opened by ptone 2
Owner
Zubair Hamed
Code Monkey, Hardware Junkie
Zubair Hamed
Diameter stack and Base Protocol (RFC 6733) for the Go programming language

Diameter Base Protocol Package go-diameter is an implementation of the Diameter Base Protocol RFC 6733 and a stack for the Go programming language. St

Alexandre Fiori 214 Dec 28, 2022
Package dhcp6 implements a DHCPv6 server, as described in RFC 3315. MIT Licensed.

dhcp6 Package dhcp6 implements a DHCPv6 server, as described in IETF RFC 3315. MIT Licensed. At this time, the API is not stable, and may change over

Matt Layher 76 Sep 27, 2022
A pure Unix shell script implementing ACME client protocol

An ACME Shell script: acme.sh An ACME protocol client written purely in Shell (Unix shell) language. Full ACME protocol implementation. Support ACME v

acme.sh 29.8k Jan 2, 2023
Package arp implements the ARP protocol, as described in RFC 826. MIT Licensed.

arp Package arp implements the ARP protocol, as described in RFC 826. MIT Licensed. Portions of this code are taken from the Go standard library. The

Matt Layher 305 Dec 20, 2022
Fast RFC 5389 STUN implementation in go

STUN Package stun implements Session Traversal Utilities for NAT (STUN) [RFC5389] protocol and client with no external dependencies and zero allocatio

null 487 Nov 28, 2022
URI Templates (RFC 6570) implemented in Go

uritemplates -- import "github.com/jtacoma/uritemplates" Package uritemplates is a level 4 implementation of RFC 6570 (URI Template, http://tools.ietf

Joshua Tacoma 71 Jan 15, 2022
Fast RFC 5389 STUN implementation in go

STUN Package stun implements Session Traversal Utilities for NAT (STUN) [RFC5389] protocol and client with no external dependencies and zero allocatio

null 488 Jan 1, 2023
RFC 1413 compliant fake identd

RFC 1413 compliant fake identd. It is an implementation of the Ident Protocol, but it lies to the clients and always returns fake identities of queried users.

Hyeon Kim (김지현) 3 Oct 29, 2022
Rabbitio - Rabbit stream cipher package RFC 4503 for Go

rabbitio rabbitio is a rabbit stream cipher packge based on RFC 4503 for golang

Sina Ghaderi 8 Dec 14, 2022
Server and client implementation of the grpc go libraries to perform unary, client streaming, server streaming and full duplex RPCs from gRPC go introduction

Description This is an implementation of a gRPC client and server that provides route guidance from gRPC Basics: Go tutorial. It demonstrates how to u

Joram Wambugu 0 Nov 24, 2021
A reverse proxy implementing IRC-over-WebSockets

webircproxy webircproxy is a reverse proxy that accepts IRCv3-over-WebSocket connections, then forwards them to a conventional ircd that speaks the no

Ergo.Chat 3 Dec 22, 2021
Implementing SPEEDEX price computation engine in Golang as a standalone binary that exchanges can call

speedex-standalone Implementing SPEEDEX price computation engine in Golang as a standalone binary that exchanges can call. Notes from Geoff About Tato

Samuel Wong 1 Dec 1, 2021
Anaximander is an ISP probing tool implementing several reduction techniques to cut down the number of probes launched in order to map an Autonomous System

Anaximander is an ISP probing tool implementing several reduction techniques to cut down the number of probes launched in order to map an Autonomous System, while still keeping high discovery levels.

null 2 Jun 21, 2022
A Language Server Protocol (LSP) server for Jsonnet

Jsonnet Language Server Warning: This project is in active development and is likely very buggy. A Language Server Protocol (LSP) server for Jsonnet.

Jack Baldry 16 Nov 22, 2022
language server protocol sdk implement for go

LSP(language server protocol) defines for golang lsp types is from vscode-languageserver-node. Project is working in progress. Example func main() {

Tobias Yin 48 Dec 17, 2022
A simple Go server/microservice example for Docker's Go Language Guide.

docker-gs-ping A simple Go server/microservice example for Docker's Go Language Guide. Notable features: Includes a multi-stage Dockerfile, which actu

shuntagami 0 Nov 28, 2021
Create HTTP server with go language.

go-http-server Create HTTP server with go language. 一、HTTP Server的简单实现 1.简单的Server接口定义 该接口包含了路由、服务启动、服务关闭功能 2.路由中包含了访问路径以及处理函数 3.服务启动 初始化服务时,可以起对应服务名称

jun.hai 1 Jan 7, 2022
Gunkls - Gunk language server with golang

WARNING: This repository is in active development. There are no guarantees about

Gunk Project 4 May 23, 2022