net

package
v2.5.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 27, 2024 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UDP4 = "udp4"
	UDP6 = "udp6"
)
View Source
const DefaultMaxMessageSize = 2 * 1024 * 1024

Variables

View Source
var ErrInvalidExternalAddress = errors.New("invalid externalAddress")
View Source
var ErrKeyNotFound = errors.New("key not found")

Functions

func CreateLoggingMiddleware

func CreateLoggingMiddleware(logger log.Logger) func(next mux.Handler) mux.Handler

func CreateResponseError

func CreateResponseError(ctx context.Context, err error, token message.Token) *pool.Message

Types

type Config

type Config struct {
	ExternalAddresses     []string      `yaml:"externalAddresses"`
	MaxMessageSize        uint32        `yaml:"maxMessageSize"`
	DeduplicationLifetime time.Duration `yaml:"deduplicationLifetime"`
	// contains filtered or unexported fields
}

func (*Config) Validate

func (cfg *Config) Validate() error

type Net

type Net struct {
	// contains filtered or unexported fields
}

func New

func New(cfg Config, handler RequestHandler, logger log.Logger) (*Net, error)

func (*Net) Close

func (n *Net) Close() error

func (*Net) GetEndpoints

func (n *Net) GetEndpoints(cm *net.ControlMessage, localAddr string) schema.Endpoints

func (*Net) Serve

func (n *Net) Serve() error

func (*Net) ServeCOAP

func (n *Net) ServeCOAP(w mux.ResponseWriter, request *mux.Message)

type Request

type Request struct {
	*pool.Message
	Conn      mux.Conn
	Endpoints schema.Endpoints
}

func (*Request) DeviceID

func (r *Request) DeviceID() uuid.UUID

func (*Request) GetValueFromQuery

func (r *Request) GetValueFromQuery(key string) (string, error)

func (*Request) Interface

func (r *Request) Interface() string

func (*Request) ResourceTypes

func (r *Request) ResourceTypes() []string

func (*Request) URIPath

func (r *Request) URIPath() string

type RequestHandler

type RequestHandler func(req *Request) (*pool.Message, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL