Documentation ¶
Index ¶
- Variables
- func ConnectTimeoutOption(timeout time.Duration) *time.Duration
- func Fingerprint(cert *x509.Certificate, algo HashAlgorithm) (string, error)
- func GenerateSelfSigned() (tls.Certificate, error)
- func SelfSign(key crypto.PrivateKey) (tls.Certificate, error)
- type CipherSuiteID
- type ClientAuthType
- type Closer
- type Config
- type Conn
- func (c *Conn) Close() error
- func (c *Conn) Export() (*State, net.Conn, error)
- func (c *Conn) ExportKeyingMaterial(label string, context []byte, length int) ([]byte, error)
- func (c *Conn) LocalAddr() net.Addr
- func (c *Conn) Read(p []byte) (n int, err error)
- func (c *Conn) RemoteAddr() net.Addr
- func (c *Conn) RemoteCertificate() [][]byte
- func (c *Conn) SelectedSRTPProtectionProfile() (SRTPProtectionProfile, bool)
- func (c *Conn) SetDeadline(t time.Time) error
- func (c *Conn) SetReadDeadline(t time.Time) error
- func (c *Conn) SetWriteDeadline(t time.Time) error
- func (c *Conn) Write(p []byte) (int, error)
- type ExtendedMasterSecretType
- type HashAlgorithm
- type Listener
- type PSKCallback
- type SRTPProtectionProfile
- type State
Constants ¶
This section is empty.
Variables ¶
var (
ErrConnClosed = errors.New("dtls: conn is closed")
)
Typed errors
Functions ¶
func ConnectTimeoutOption ¶
ConnectTimeoutOption simply provides a wrapper for creating a *time.Duration
func Fingerprint ¶
func Fingerprint(cert *x509.Certificate, algo HashAlgorithm) (string, error)
Fingerprint creates a fingerprint for a certificate using the specified hash algorithm
func GenerateSelfSigned ¶
func GenerateSelfSigned() (tls.Certificate, error)
GenerateSelfSigned creates a self-signed certificate
func SelfSign ¶
func SelfSign(key crypto.PrivateKey) (tls.Certificate, error)
SelfSign creates a self-signed certificate from a elliptic curve key
Types ¶
type CipherSuiteID ¶
type CipherSuiteID uint16
CipherSuiteID is an ID for our supported CipherSuites
const ( // AES-128-CCM TLS_ECDHE_ECDSA_WITH_AES_128_CCM CipherSuiteID = 0xc0ac TLS_ECDHE_ECDSA_WITH_AES_128_CCM_8 CipherSuiteID = 0xc0ae // AES-128-GCM-SHA256 TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 CipherSuiteID = 0xc02b TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 CipherSuiteID = 0xc02f // AES-256-CBC-SHA TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA CipherSuiteID = 0xc00a TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA CipherSuiteID = 0xc014 TLS_PSK_WITH_AES_128_CCM CipherSuiteID = 0xc0a4 TLS_PSK_WITH_AES_128_CCM_8 CipherSuiteID = 0xc0a8 TLS_PSK_WITH_AES_128_GCM_SHA256 CipherSuiteID = 0x00a8 )
Supported Cipher Suites
func (CipherSuiteID) String ¶
func (c CipherSuiteID) String() string
type ClientAuthType ¶
type ClientAuthType int
ClientAuthType declares the policy the server will follow for TLS Client Authentication.
const ( NoClientCert ClientAuthType = iota RequestClientCert RequireAnyClientCert VerifyClientCertIfGiven RequireAndVerifyClientCert )
ClientAuthType enums
type Closer ¶
type Closer struct {
// contains filtered or unexported fields
}
Closer allows for each signaling a channel for shutdown
func NewCloserWithParent ¶
NewCloserWithParent creates a new instance of Closer with a parent context
type Config ¶
type Config struct { // Certificates contains certificate chain to present to the other side of the connection. // Server MUST set this if PSK is non-nil // client SHOULD sets this so CertificateRequests can be handled if PSK is non-nil // TODO: add support to use more certificates then one. Certificates []tls.Certificate // CipherSuites is a list of supported cipher suites. // If CipherSuites is nil, a default list is used CipherSuites []CipherSuiteID // SRTPProtectionProfiles are the supported protection profiles // Clients will send this via use_srtp and assert that the server properly responds // Servers will assert that clients send one of these profiles and will respond as needed SRTPProtectionProfiles []SRTPProtectionProfile // ClientAuth determines the server's policy for // TLS Client Authentication. The default is NoClientCert. ClientAuth ClientAuthType // RequireExtendedMasterSecret determines if the "Extended Master Secret" extension // should be disabled, requested, or required (default requested). ExtendedMasterSecret ExtendedMasterSecretType // FlightInterval controls how often we send outbound handshake messages // defaults to time.Second FlightInterval time.Duration // PSK sets the pre-shared key used by this DTLS connection // If PSK is non-nil only PSK CipherSuites will be used PSK PSKCallback PSKIdentityHint []byte // InsecureSkipVerify controls whether a client verifies the // server's certificate chain and host name. // If InsecureSkipVerify is true, TLS accepts any certificate // presented by the server and any host name in that certificate. // In this mode, TLS is susceptible to man-in-the-middle attacks. // This should be used only for testing. InsecureSkipVerify bool // VerifyPeerCertificate, if not nil, is called after normal // certificate verification by either a client or server. It // receives the certificate provided by the peer and also a flag // that tells if normal verification has succeedded. If it returns a // non-nil error, the handshake is aborted and that error results. // // If normal verification fails then the handshake will abort before // considering this callback. If normal verification is disabled by // setting InsecureSkipVerify, or (for a server) when ClientAuth is // RequestClientCert or RequireAnyClientCert, then this callback will // be considered but the verifiedChains will always be nil. VerifyPeerCertificate func(rawCerts [][]byte, verifiedChains [][]*x509.Certificate) error // RootCAs defines the set of root certificate authorities // that one peer uses when verifying the other peer's certificates. // If RootCAs is nil, TLS uses the host's root CA set. RootCAs *x509.CertPool // ClientCAs defines the set of root certificate authorities // that servers use if required to verify a client certificate // by the policy in ClientAuth. ClientCAs *x509.CertPool // ServerName is used to verify the hostname on the returned // certificates unless InsecureSkipVerify is given. ServerName string LoggerFactory logging.LoggerFactory // ConnectTimeout is the timeout threshold for new connection handshakes // to complete (default is 30 seconds) ConnectTimeout *time.Duration // MTU is the length at which handshake messages will be fragmented to // fit within the maximum transmission unit (default is 1200 bytes) MTU int }
Config is used to configure a DTLS client or server. After a Config is passed to a DTLS function it must not be modified.
type Conn ¶
type Conn struct {
// contains filtered or unexported fields
}
Conn represents a DTLS connection
func (*Conn) Export ¶
Export extracts dtls state and inner connection from an already handshaked dtls conn
func (*Conn) ExportKeyingMaterial ¶
ExportKeyingMaterial from https://tools.ietf.org/html/rfc5705 This allows protocols to use DTLS for key establishment, but then use some of the keying material for their own purposes
func (*Conn) RemoteCertificate ¶
RemoteCertificate exposes the remote certificate
func (*Conn) SelectedSRTPProtectionProfile ¶
func (c *Conn) SelectedSRTPProtectionProfile() (SRTPProtectionProfile, bool)
SelectedSRTPProtectionProfile returns the selected SRTPProtectionProfile
func (*Conn) SetReadDeadline ¶
SetReadDeadline is a stub
func (*Conn) SetWriteDeadline ¶
SetWriteDeadline is a stub
type ExtendedMasterSecretType ¶
type ExtendedMasterSecretType int
ExtendedMasterSecretType declares the policy the client and server will follow for the Extended Master Secret extension
const ( RequestExtendedMasterSecret ExtendedMasterSecretType = iota RequireExtendedMasterSecret DisableExtendedMasterSecret )
ExtendedMasterSecretType enums
type HashAlgorithm ¶
type HashAlgorithm uint16
HashAlgorithm is used to indicate the hash algorithm used https://www.iana.org/assignments/tls-parameters/tls-parameters.xhtml#tls-parameters-18
const ( // HashAlgorithmMD2 HashAlgorithm = 0 // Blacklisted HashAlgorithmMD5 HashAlgorithm = 1 // Blacklisted HashAlgorithmSHA1 HashAlgorithm = 2 // Blacklisted HashAlgorithmSHA224 HashAlgorithm = 3 HashAlgorithmSHA256 HashAlgorithm = 4 HashAlgorithmSHA384 HashAlgorithm = 5 HashAlgorithmSHA512 HashAlgorithm = 6 )
Supported hash hash algorithms
func HashAlgorithmString ¶
func HashAlgorithmString(s string) (HashAlgorithm, error)
HashAlgorithmString allows looking up a HashAlgorithm by it's string representation
func (HashAlgorithm) String ¶
func (h HashAlgorithm) String() string
String makes HashAlgorithm printable
type Listener ¶
type Listener struct {
// contains filtered or unexported fields
}
Listener represents a DTLS listener
func (*Listener) Accept ¶
Accept waits for and returns the next connection to the listener. You have to either close or read on all connection that are created.
type PSKCallback ¶
PSKCallback is called once we have the remote's PSKIdentityHint. If the remote provided none it will be nil
type SRTPProtectionProfile ¶
type SRTPProtectionProfile uint16
SRTPProtectionProfile defines the parameters and options that are in effect for the SRTP processing https://tools.ietf.org/html/rfc5764#section-4.1.2
const (
SRTP_AES128_CM_HMAC_SHA1_80 SRTPProtectionProfile = 0x0001 // nolint
)
type State ¶
type State struct {
// contains filtered or unexported fields
}
State holds the dtls connection state and implements both encoding.BinaryMarshaler and encoding.BinaryUnmarshaler
func (*State) MarshalBinary ¶
MarshalBinary is a binary.BinaryMarshaler.MarshalBinary implementation
func (*State) UnmarshalBinary ¶
UnmarshalBinary is a binary.BinaryUnmarshaler.UnmarshalBinary implementation
Source Files ¶
- alert.go
- application_data.go
- atomic_error.go
- change_cipher_spec.go
- cipher_suite.go
- cipher_suite_aes_128_ccm.go
- cipher_suite_tls_ecdhe_ecdsa_with_aes_128_ccm.go
- cipher_suite_tls_ecdhe_ecdsa_with_aes_128_ccm8.go
- cipher_suite_tls_ecdhe_ecdsa_with_aes_128_gcm_sha256.go
- cipher_suite_tls_ecdhe_ecdsa_with_aes_256_cbc_sha.go
- cipher_suite_tls_ecdhe_rsa_with_aes_128_gcm_sha256.go
- cipher_suite_tls_ecdhe_rsa_with_aes_256_cbc_sha.go
- cipher_suite_tls_psk_with_aes_128_ccm.go
- cipher_suite_tls_psk_with_aes_128_ccm8.go
- cipher_suite_tls_psk_with_aes_128_gcm_sha256.go
- client_certificate_type.go
- client_handlers.go
- closer.go
- compression_method.go
- config.go
- conn.go
- content.go
- crypto.go
- crypto_cbc.go
- crypto_ccm.go
- crypto_gcm.go
- curve_type.go
- errors.go
- extension.go
- extension_supported_elliptic_curves.go
- extension_supported_point_formats.go
- extension_supported_signature_algorithms.go
- extension_use_master_secret.go
- extension_use_srtp.go
- fingerprint.go
- flight.go
- fragment_buffer.go
- handshake.go
- handshake_cache.go
- handshake_header.go
- handshake_message_certificate.go
- handshake_message_certificate_request.go
- handshake_message_certificate_verify.go
- handshake_message_client_hello.go
- handshake_message_client_key_exchange.go
- handshake_message_finished.go
- handshake_message_hello_verify_request.go
- handshake_message_server_hello.go
- handshake_message_server_hello_done.go
- handshake_message_server_key_exchange.go
- handshake_random.go
- hash_algorithm.go
- listener.go
- named_curve.go
- packet.go
- prf.go
- record_layer.go
- record_layer_header.go
- resume.go
- server_handlers.go
- signature_algorithm.go
- signature_hash_algorithm.go
- srtp_protection_profile.go
- state.go
- util.go
Directories ¶
Path | Synopsis |
---|---|
Package e2e contains end to end tests for pion/dtls
|
Package e2e contains end to end tests for pion/dtls |
examples
|
|
internal
|
|
crypto/ccm
Package ccm implements a CCM, Counter with CBC-MAC as per RFC 3610.
|
Package ccm implements a CCM, Counter with CBC-MAC as per RFC 3610. |
dpipe
Package dpipe provides the pipe works like datagram protocol on memory.
|
Package dpipe provides the pipe works like datagram protocol on memory. |