package dtls

import "github.com/plgd-dev/go-coap/v3/dtls"

Index

Variables

var DefaultConfig = func() udpClient.Config {
	cfg := udpClient.DefaultConfig
	cfg.Handler = func(w *responsewriter.ResponseWriter[*udpClient.Conn], r *pool.Message) {
		switch r.Code() {
		case codes.POST, codes.PUT, codes.GET, codes.DELETE:
			if err := w.SetResponse(codes.NotFound, message.TextPlain, nil); err != nil {
				cfg.Errors(fmt.Errorf("dtls client: cannot set response: %w", err))
			}
		}
	}
	return cfg
}()

Functions

func Client

func Client(conn *dtls.Conn, opts ...udp.Option) *udpClient.Conn

Client creates client over dtls connection.

func Dial

func Dial(target string, dtlsCfg *dtls.Config, opts ...udp.Option) (*udpClient.Conn, error)

Dial creates a client connection to the given target.

func NewServer

func NewServer(opt ...server.Option) *server.Server

Source Files

client.go server.go

Directories

PathSynopsis
dtls/server
Version
v3.3.6 (latest)
Published
Sep 18, 2024
Platform
linux/amd64
Imports
15 packages
Last checked
1 week ago

Tools for package owners.