net

package
v2.6.0 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2025 License: Apache-2.0 Imports: 28 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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