dtls: github.com/bocajim/dtls Index | Files | Directories

package dtls

import "github.com/bocajim/dtls"


Package Files

alert.go bytereader.go bytewriter.go common.go crypto.go debug.go dtls.go handshake.go handshake_clienthello.go handshake_clientkeyexchange.go handshake_finished.go handshake_header.go handshake_helloverifyrequest.go handshake_serverhello.go handshake_serverhellodone.go handshake_serverkeyexchange.go handshake_unknown.go keystore.go log.go peer.go record.go session.go session_cache.go session_handshake.go transport.go transport_udp.go


const (
    AlertType_Warning                uint8 = 1
    AlertType_Fatal                  uint8 = 2
    AlertDesc_CloseNotify            uint8 = 0
    AlertDesc_UnexpectedMessage      uint8 = 10
    AlertDesc_BadRecordMac           uint8 = 20
    AlertDesc_DecryptionFailed       uint8 = 21
    AlertDesc_RecordOverflow         uint8 = 22
    AlertDesc_DecompressionFailure   uint8 = 30
    AlertDesc_HandshakeFailure       uint8 = 40
    AlertDesc_NoCertificate          uint8 = 41
    AlertDesc_BadCertificate         uint8 = 42
    AlertDesc_UnsupportedCertificate uint8 = 43
    AlertDesc_CertificateRevoked     uint8 = 44
    AlertDesc_CertificateExpired     uint8 = 45
    AlertDesc_CertificateUnknown     uint8 = 46
    AlertDesc_IllegalParameter       uint8 = 47
    AlertDesc_UnknownCa              uint8 = 48
    AlertDesc_AccessDenied           uint8 = 49
    AlertDesc_DecodeError            uint8 = 50
    AlertDesc_DecryptError           uint8 = 51
    AlertDesc_ExportRestriction      uint8 = 60
    AlertDesc_ProtocolVersion        uint8 = 70
    AlertDesc_InsufficientSecurity   uint8 = 71
    AlertDesc_InternalError          uint8 = 80
    AlertDesc_UserCanceled           uint8 = 90
    AlertDesc_NoRenegotiation        uint8 = 100
    AlertDesc_UnsupportedExtension   uint8 = 110
    AlertDesc_Noop                   uint8 = 254
const (
    LogLevelError string = "error"
    LogLevelWarn  string = "warn"
    LogLevelInfo  string = "info"
    LogLevelDebug string = "debug"
const (
    ContentType_ChangeCipherSpec ContentType = 20
    ContentType_Alert                        = 21
    ContentType_Handshake                    = 22
    ContentType_Appdata                      = 23
const (
    SessionType_Server string = "server"
    SessionType_Client string = "client"
const (
    AadAuthLen int = 13
const (
    DtlsVersion12 uint16 = 0xFEFD


var DebugEncryption bool = false
var DebugHandshake bool = false
var DebugHandshakeHash bool = false
var HandshakeCompleteCallback func(string, string, time.Duration, error)

This callback is invoked each time a handshake completes, if the handshake failed, the reason is stored in error

var PeerInactivityTimeout = time.Hour * 24
var SessionCacheSweepInterval = time.Minute * -5

set to the interval to look for expired sessions

var SessionCacheTtl = time.Hour * 24

set to whatever you want the cache time to live to be

func DebugAll Uses

func DebugAll()

func GetPskFromKeystore Uses

func GetPskFromKeystore(identity string, remoteAddr string) []byte

func SessionCacheSize Uses

func SessionCacheSize() int

func SetKeyStores Uses

func SetKeyStores(ks []Keystore)

func SetLogFunc Uses

func SetLogFunc(lf LogFunc)

func SetLogLevel Uses

func SetLogLevel(level string)

type CipherSuite Uses

type CipherSuite uint16
const (
    CipherSuite_TLS_PSK_WITH_AES_128_CCM_8 CipherSuite = 0xC0A8

type CompressionMethod Uses

type CompressionMethod uint8
const (
    CompressionMethod_Null CompressionMethod = 0

type ContentType Uses

type ContentType uint8

type Keystore Uses

type Keystore interface {
    GetPsk(identity string, remoteAddr string) ([]byte, error)

type KeystoreInMemory Uses

type KeystoreInMemory struct {
    // contains filtered or unexported fields

func NewKeystoreInMemory Uses

func NewKeystoreInMemory() *KeystoreInMemory

func (*KeystoreInMemory) AddKey Uses

func (ks *KeystoreInMemory) AddKey(identity string, psk []byte)

func (*KeystoreInMemory) GetPsk Uses

func (ks *KeystoreInMemory) GetPsk(identity string, remoteAddr string) ([]byte, error)

type Listener Uses

type Listener struct {
    // contains filtered or unexported fields

func NewUdpListener Uses

func NewUdpListener(listener string, readTimeout time.Duration) (*Listener, error)

func (*Listener) AddCipherSuite Uses

func (l *Listener) AddCipherSuite(cipherSuite CipherSuite)

func (*Listener) AddCompressionMethod Uses

func (l *Listener) AddCompressionMethod(compressionMethod CompressionMethod)

func (*Listener) AddPeer Uses

func (l *Listener) AddPeer(addr string, identity string) (*Peer, error)

func (*Listener) AddPeerWithParams Uses

func (l *Listener) AddPeerWithParams(params *PeerParams) (*Peer, error)

func (*Listener) CountPeers Uses

func (l *Listener) CountPeers() int

func (*Listener) FindPeer Uses

func (l *Listener) FindPeer(addr string) (*Peer, error)

func (*Listener) Read Uses

func (l *Listener) Read() ([]byte, *Peer)

func (*Listener) RemovePeer Uses

func (l *Listener) RemovePeer(peer *Peer, alertDesc uint8) error

func (*Listener) RemovePeerByAddr Uses

func (l *Listener) RemovePeerByAddr(addr string, alertDesc uint8) error

func (*Listener) Shutdown Uses

func (l *Listener) Shutdown() error

type LogFunc Uses

type LogFunc func(ts time.Time, level string, peer string, msg string)

type Peer Uses

type Peer struct {
    // contains filtered or unexported fields

func (*Peer) Close Uses

func (p *Peer) Close(alertDesc uint8)

func (*Peer) LastActivity Uses

func (p *Peer) LastActivity() time.Time

func (*Peer) Lock Uses

func (p *Peer) Lock()

func (*Peer) Read Uses

func (p *Peer) Read(timeout time.Duration) ([]byte, error)

func (*Peer) RemoteAddr Uses

func (p *Peer) RemoteAddr() string

func (*Peer) SessionIdentity Uses

func (p *Peer) SessionIdentity() string

func (*Peer) Unlock Uses

func (p *Peer) Unlock()

func (*Peer) UseQueue Uses

func (p *Peer) UseQueue(en bool)

func (*Peer) Write Uses

func (p *Peer) Write(data []byte) error

type PeerParams Uses

type PeerParams struct {
    Addr             string
    Identity         string
    HandshakeTimeout time.Duration
    SessionId        []byte

type Transport Uses

type Transport interface {
    Type() string
    Local() string
    Shutdown() error
    NewPeer(address string) TransportPeer
    ReadPacket() ([]byte, TransportPeer, error)

type TransportPeer Uses

type TransportPeer interface {
    String() string
    WritePacket(data []byte) error

func NewUdpPeerFromSocket Uses

func NewUdpPeerFromSocket(socket *net.UDPConn, addr *net.UDPAddr) TransportPeer


ccmPackage ccm implements a CCM, Counter with CBC-MAC as per RFC 3610.

Package dtls imports 17 packages (graph). Updated 2019-06-04. Refresh now. Tools for package owners.