dtls

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2018 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddListener

func AddListener(src string, conn *ipv4.PacketConn)

AddListener adds the socket to a map that can be accessed by OpenSSL for sending This only needed until DTLS is rewritten in native Go

func RemoveListener

func RemoveListener(src string)

RemoveListener removes the socket from a map that can be accessed by OpenSSL for sending This only needed until DTLS is rewritten in native Go

Types

type CertPair

type CertPair struct {
	ClientWriteKey []byte
	ServerWriteKey []byte
	Profile        string
}

CertPair is the client+server key and profile extracted for SRTP

type ConnectionState added in v1.1.0

type ConnectionState uint8

ConnectionState determines the DTLS connection state

const (
	New ConnectionState = iota + 1
	Established
)

ConnectionState enums

func (ConnectionState) String added in v1.1.0

func (a ConnectionState) String() string

type State

type State struct {
	sync.Mutex
	// contains filtered or unexported fields
}

State represents all the state needed for a DTLS session

func NewState

func NewState(notifier func(ConnectionState)) (s *State, err error)

NewState creates a new DTLS session

func (*State) Close

func (s *State) Close()

Close cleans up the associated OpenSSL resources

func (*State) DoHandshake

func (s *State) DoHandshake(local, remote string)

DoHandshake sends the DTLS handshake it the remote peer

func (*State) Fingerprint added in v1.1.0

func (s *State) Fingerprint() string

Fingerprint generates a SHA-256 fingerprint of the certificate

func (*State) GetCertPair added in v1.1.0

func (s *State) GetCertPair() *CertPair

GetCertPair gets the current CertPair if DTLS has finished

func (*State) HandleDTLSPacket

func (s *State) HandleDTLSPacket(packet []byte, local, remote string) ([]byte, error)

HandleDTLSPacket checks if the packet is a DTLS packet, and if it is passes to the DTLS session If there is any data after decoding we pass back to the caller to handler

func (*State) Send added in v1.1.0

func (s *State) Send(packet []byte, local, remote string) (bool, error)

Send takes a un-encrypted packet and sends via DTLS

func (*State) Start added in v1.1.0

func (s *State) Start(isOffer bool)

Start allocates DTLS/ICE state that is dependent on if we are offering or answering

Jump to

Keyboard shortcuts

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