Popularity
5.3
Declining
Activity
0.0
Stable
150
14
41
Programming language: Go
License: Apache License 2.0
Tags:
Networking
canopus alternatives and similar packages
Based on the "Networking" category.
Alternatively, view canopus alternatives based on common mentions on social networks and blogs.
-
fasthttp
Fast HTTP package for Go. Tuned for high performance. Zero memory allocations in hot paths. Up to 10x faster than net/http -
kcptun
A Stable & Secure Tunnel based on KCP with N:M multiplexing and FEC. Available for ARM, MIPS, 386 and AMD64。N:M 多重化と FEC を備えた KCP に基づく安定した安全なトンネル。 N:M 다중화 및 FEC를 사용하는 KCP 기반의 안정적이고 안전한 터널입니다. Un tunnel stable et sécurisé basé sur KCP avec multiplexage N:M et FEC. -
gnet
🚀 gnet is a high-performance, lightweight, non-blocking, event-driven networking framework written in pure Go./ gnet 是一个高性能、轻量级、非阻塞的事件驱动 Go 网络框架。 -
Netmaker
Netmaker makes networks with WireGuard. Netmaker automates fast, secure, and distributed virtual networks. -
kcp-go
A Crypto-Secure, Production-Grade Reliable-UDP Library for golang with FEC -
netpoll
A high-performance non-blocking I/O networking framework, which focused on RPC scenarios, developed by ByteDance. -
fortio
Fortio load testing library, command line tool, advanced echo server and web UI in go (golang). Allows to specify a set query-per-second load and record latency histograms and other useful stats. -
mqttPaho
The Paho Go Client provides an MQTT client library for connection to MQTT brokers via TCP, TLS or WebSockets. -
go-getter
Package for downloading things from a string URL using a variety of protocols. -
gobetween
:cloud: Modern & minimalistic load balancer for the Сloud era -
gev
🚀Gev is a lightweight, fast non-blocking TCP network library / websocket server based on Reactor mode. Support custom protocols to quickly and easily build high-performance servers. -
nbio
Pure Go 1000k+ connections solution, support tls/http1.x/websocket and basically compatible with net/http, with high-performance and low memory cost, non-blocking, event-driven, easy-to-use. -
gmqtt
Gmqtt is a flexible, high-performance MQTT broker library that fully implements the MQTT protocol V3.x and V5 in golang -
easytcp
:sparkles: :rocket: EasyTCP is a light-weight TCP framework written in Go (Golang), built with message router. EasyTCP helps you build a TCP server easily fast and less painful. -
peerdiscovery
Pure-Go library for cross-platform local peer discovery using UDP multicast :woman: :repeat: :woman: -
raw
Package raw enables reading and writing data at the device driver level for a network interface. MIT Licensed. -
gaio
High performance async-io(proactor) networking for Golang。golangのための高性能非同期io(proactor)ネットワーキング -
winrm
Command-line tool and library for Windows remote command execution in Go -
arp
Package arp implements the ARP protocol, as described in RFC 826. MIT Licensed. -
go-cleanhttp
Get easily stdlib HTTP client, which does not share any state with other clients. -
buffstreams
A library to simplify writing applications using TCP sockets to stream protobuff messages -
ethernet
Package ethernet implements marshaling and unmarshaling of IEEE 802.3 Ethernet II frames and IEEE 802.1Q VLAN tags. MIT Licensed.
Access the most powerful time series database as a service
Ingest, store, & analyze all types of time series data in a fully-managed, purpose-built database. Keep data forever with low-cost storage and superior data compression.
Promo
www.influxdata.com
Do you think we are missing an alternative of canopus or a related project?
Popular Comparisons
README
Canopus
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 implementation. 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.
Building and running
- git submodule update --init --recursive
- cd openssl
- ./config && make
- 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())