dtls

package module
v0.0.0-...-318974a Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2020 License: MIT Imports: 25 Imported by: 0

README

dtls

DTLS 1.2

Documentation

Index

Constants

View Source
const (
	DTLS_RSA_WITH_3DES_EDE_CBC_SHA           uint16 = 0x000a
	DTLS_RSA_WITH_AES_128_CBC_SHA            uint16 = 0x002f
	DTLS_RSA_WITH_AES_256_CBC_SHA            uint16 = 0x0035
	DTLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA    uint16 = 0xc009
	DTLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA    uint16 = 0xc00a
	DTLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA     uint16 = 0xc012
	DTLS_ECDHE_RSA_WITH_AES_128_CBC_SHA      uint16 = 0xc013
	DTLS_ECDHE_RSA_WITH_AES_256_CBC_SHA      uint16 = 0xc014
	DTLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256   uint16 = 0xc02f
	DTLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 uint16 = 0xc02b
)

Cipher suites

View Source
const (
	VersionDTLS10 = 0x0301
	VersionDTLS12 = 0x0303
)
View Source
const (
	Port string = ":8080"
)

Variables

This section is empty.

Functions

func DialAndWrite

func DialAndWrite(config *Config)

for testing

Types

type Certificate

type Certificate struct {
	Certificate [][]byte
	PrivateKey  crypto.PrivateKey
	OCSPStaple  []byte
	Leaf        *x509.Certificate
}

func LoadX509KeyPair

func LoadX509KeyPair(certFile, keyFile string) (cert Certificate, err error)

same as "tls" implementation

func X509KeyPair

func X509KeyPair(certPEMBlock, keyPEMBlock []byte) (cert Certificate, err error)

same as "tls" implementation

type ClientAuthType

type ClientAuthType int
const (
	NoClientCert ClientAuthType = iota
	RequestClientCert
	RequireAnyClientCert
	VerifyClientCertIfGiven
	RequireAndVerifyClientCert
)

type Config

type Config struct {
	Rand                     io.Reader
	Time                     func() time.Time
	Certificates             []Certificate
	NameToCertificate        map[string]*Certificate
	RootCAs                  *x509.CertPool
	NextProtos               []string
	ServerName               string
	ClientAuth               ClientAuthType
	ClientCAs                *x509.CertPool
	InsecureSkipVerify       bool
	CipherSuites             []uint16
	PreferServerCipherSuites bool
	SessionTicketsDisabled   bool
	SessionTicketKey         [32]byte
	MinVersion               uint16
	MaxVersion               uint16
	// contains filtered or unexported fields
}

type DTLSConn

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

func Client

func Client(conn net.UDPConn, addr *net.UDPAddr, config *Config) *DTLSConn

func Dial

func Dial(network, addr string, config *Config) (c *DTLSConn, err error)

func Server

func Server(conn net.UDPConn, addr *net.UDPAddr, config *Config) *DTLSConn

func (*DTLSConn) Close

func (c *DTLSConn) Close() (err error)

func (*DTLSConn) Handshake

func (c *DTLSConn) Handshake() (err error)

func (*DTLSConn) LocalAddr

func (c *DTLSConn) LocalAddr() net.Addr

func (*DTLSConn) Read

func (c *DTLSConn) Read(b []byte) (n int, err error)

func (*DTLSConn) RemoteAddr

func (c *DTLSConn) RemoteAddr() net.Addr

func (*DTLSConn) SetDeadline

func (c *DTLSConn) SetDeadline(t time.Time) error

func (*DTLSConn) SetReadDeadline

func (c *DTLSConn) SetReadDeadline(t time.Time) error

func (*DTLSConn) SetWriteDeadline

func (c *DTLSConn) SetWriteDeadline(t time.Time) error

func (*DTLSConn) Write

func (c *DTLSConn) Write(b []byte) (n int, err error)

type DTLSMultiplexedConn

type DTLSMultiplexedConn struct {
	net.UDPConn
	// contains filtered or unexported fields
}

func Listen

func Listen(network, addr string, config *Config) (c *DTLSMultiplexedConn, err error)

func (*DTLSMultiplexedConn) Accept

func (conn *DTLSMultiplexedConn) Accept() (c *DTLSConn, err error)

Jump to

Keyboard shortcuts

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