Documentation
¶
Index ¶
- func NewBackend() backends.Backend
- type Backend
- func (b *Backend) GetMode() string
- func (b *Backend) Logger() backends.MiddlewareFunc
- func (b *Backend) NewEngine() backends.Engine
- func (b *Backend) NewEngineWithDefaults() backends.Engine
- func (b *Backend) NewServer(port int, engine backends.Engine) backends.Server
- func (b *Backend) NewServerWithAddr(addr string, engine backends.Engine) backends.Server
- func (b *Backend) NewServerWithAddrAndHandler(addr string, handler RPCHandler) backends.Server
- func (b *Backend) NewServerWithHandler(port int, handler RPCHandler) backends.Server
- func (b *Backend) Recovery() backends.MiddlewareFunc
- func (b *Backend) SetMode(mode string)
- type CoAPServer
- func (s *CoAPServer) Engine() backends.Engine
- func (s *CoAPServer) GetAddr() string
- func (s *CoAPServer) HTTPServer() *http.Server
- func (s *CoAPServer) ListenAndServe() error
- func (s *CoAPServer) ListenAndServeTLS(certFile, keyFile string) error
- func (s *CoAPServer) SetAddr(addr string)
- func (s *CoAPServer) SetHandler(handler RPCHandler)
- func (s *CoAPServer) SetIdleTimeout(timeout time.Duration)
- func (s *CoAPServer) SetReadHeaderTimeout(timeout time.Duration)
- func (s *CoAPServer) SetReadTimeout(timeout time.Duration)
- func (s *CoAPServer) SetWriteTimeout(timeout time.Duration)
- func (s *CoAPServer) Shutdown(ctx context.Context) error
- func (s *CoAPServer) ShutdownWithTimeout(timeout time.Duration) error
- type RPCHandler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Backend ¶
type Backend struct {
// contains filtered or unexported fields
}
Backend implements the backends.Backend interface for CoAP
func (*Backend) Logger ¶
func (b *Backend) Logger() backends.MiddlewareFunc
Logger returns a no-op middleware as CoAP handles logging differently
func (*Backend) NewEngineWithDefaults ¶
NewEngineWithDefaults panics as CoAP doesn't use the Engine pattern
func (*Backend) NewServer ¶
NewServer creates a new CoAP server with the given port and handler The engine parameter is ignored for CoAP as it doesn't use the Engine pattern
func (*Backend) NewServerWithAddr ¶
NewServerWithAddr creates a new CoAP server with the given address
func (*Backend) NewServerWithAddrAndHandler ¶
func (b *Backend) NewServerWithAddrAndHandler(addr string, handler RPCHandler) backends.Server
NewServerWithAddrAndHandler creates a new CoAP server with address and handler
func (*Backend) NewServerWithHandler ¶
func (b *Backend) NewServerWithHandler(port int, handler RPCHandler) backends.Server
NewServerWithHandler creates a new CoAP server with an RPC handler
func (*Backend) Recovery ¶
func (b *Backend) Recovery() backends.MiddlewareFunc
Recovery returns a no-op middleware as CoAP handles panics differently
type CoAPServer ¶
type CoAPServer struct {
// contains filtered or unexported fields
}
CoAPServer wraps a CoAP server to implement backends.Server interface
func NewCoAPServer ¶
func NewCoAPServer(port int, handler RPCHandler) *CoAPServer
NewCoAPServer creates a new CoAP server wrapper
func NewCoAPServerWithAddr ¶
func NewCoAPServerWithAddr(addr string, handler RPCHandler) *CoAPServer
NewCoAPServerWithAddr creates a new CoAP server with a specific address
func (*CoAPServer) Engine ¶
func (s *CoAPServer) Engine() backends.Engine
Engine returns nil as CoAP doesn't use the Engine pattern
func (*CoAPServer) GetAddr ¶
func (s *CoAPServer) GetAddr() string
GetAddr returns the server address
func (*CoAPServer) HTTPServer ¶
func (s *CoAPServer) HTTPServer() *http.Server
HTTPServer returns nil as CoAP server is not an HTTP server
func (*CoAPServer) ListenAndServe ¶
func (s *CoAPServer) ListenAndServe() error
ListenAndServe starts the CoAP server
func (*CoAPServer) ListenAndServeTLS ¶
func (s *CoAPServer) ListenAndServeTLS(certFile, keyFile string) error
ListenAndServeTLS starts the CoAP server with DTLS (not implemented yet)
func (*CoAPServer) SetAddr ¶
func (s *CoAPServer) SetAddr(addr string)
SetAddr sets the server address
func (*CoAPServer) SetHandler ¶
func (s *CoAPServer) SetHandler(handler RPCHandler)
SetHandler sets the RPC handler (must be called before ListenAndServe)
func (*CoAPServer) SetIdleTimeout ¶
func (s *CoAPServer) SetIdleTimeout(timeout time.Duration)
SetIdleTimeout is a no-op for CoAP
func (*CoAPServer) SetReadHeaderTimeout ¶
func (s *CoAPServer) SetReadHeaderTimeout(timeout time.Duration)
SetReadHeaderTimeout is a no-op for CoAP
func (*CoAPServer) SetReadTimeout ¶
func (s *CoAPServer) SetReadTimeout(timeout time.Duration)
SetReadTimeout is a no-op for CoAP (CoAP handles timeouts differently)
func (*CoAPServer) SetWriteTimeout ¶
func (s *CoAPServer) SetWriteTimeout(timeout time.Duration)
SetWriteTimeout is a no-op for CoAP
func (*CoAPServer) Shutdown ¶
func (s *CoAPServer) Shutdown(ctx context.Context) error
Shutdown gracefully shuts down the CoAP server
func (*CoAPServer) ShutdownWithTimeout ¶
func (s *CoAPServer) ShutdownWithTimeout(timeout time.Duration) error
ShutdownWithTimeout shuts down with a timeout
type RPCHandler ¶
RPCHandler is an interface for handling RPC messages This is implemented by the Server struct which provides access to all business logic