Documentation ¶
Overview ¶
Package static implements interfaces, types and constants used in the rest of the project modules.
Through this package, the others communicate with each other.
Index ¶
- Constants
- func META_HEADER() []byte
- type AllowList
- type ConnClosedByDeduplicatorError
- type ConnResult
- type ConnTimeoutError
- type InapplicableProxyTypeError
- type InvalidUriError
- type IvalidPeerPublicKey
- type ProtoVersion
- type Transport
- type TransportListener
- type TransportSecurityCheckError
- type UnacceptableAddressError
- type UnknownProtoError
- type UnknownProtoVersionError
- type UnknownSchemeError
Constants ¶
const ( SECURE_LVL_UNSECURE uint = 0 SECURE_LVL_ENCRYPTED = 1 SECURE_LVL_VERIFIED = 2 SECURE_LVL_ENCRYPTED_AND_VERIFIED = 3 )
Most useful seurity levels
Variables ¶
This section is empty.
Functions ¶
func META_HEADER ¶
func META_HEADER() []byte
Returns static header of first pkg in yggdrasil connection
Types ¶
type AllowList ¶
AllowList is a list of public keys of nodes that are allowed to communicate with the current.
AllowList can be equal to nil. This should be interpreted as a connection permission for any nodes.
type ConnClosedByDeduplicatorError ¶
type ConnClosedByDeduplicatorError struct{}
func (ConnClosedByDeduplicatorError) Error ¶
func (e ConnClosedByDeduplicatorError) Error() string
func (ConnClosedByDeduplicatorError) Temporary ¶
func (e ConnClosedByDeduplicatorError) Temporary() bool
func (ConnClosedByDeduplicatorError) Timeout ¶
func (e ConnClosedByDeduplicatorError) Timeout() bool
type ConnResult ¶
type ConnResult struct { // The connection itself Conn net.Conn // Optional transport lvl public key (may be nil) Pkey ed25519.PublicKey // Lvl of connection security // Here is most used values: // - ytl.static.SECURE_LVL_UNSECURE // - ytl.static.SECURE_LVL_ENCRYPTED // - ytl.static.SECURE_LVL_VERIFIED // - ytl.static.SECURE_LVL_ENCRYPTED_AND_VERIFIED SecurityLevel uint }
ConnResult contains information received when establishing a transport connection with another node
type ConnTimeoutError ¶
type ConnTimeoutError struct{}
func (ConnTimeoutError) Error ¶
func (e ConnTimeoutError) Error() string
func (ConnTimeoutError) Temporary ¶
func (e ConnTimeoutError) Temporary() bool
func (ConnTimeoutError) Timeout ¶
func (e ConnTimeoutError) Timeout() bool
type InapplicableProxyTypeError ¶
func (InapplicableProxyTypeError) Error ¶
func (e InapplicableProxyTypeError) Error() string
func (InapplicableProxyTypeError) Temporary ¶
func (e InapplicableProxyTypeError) Temporary() bool
func (InapplicableProxyTypeError) Timeout ¶
func (e InapplicableProxyTypeError) Timeout() bool
type InvalidUriError ¶
type InvalidUriError struct {
Err string
}
func (InvalidUriError) Error ¶
func (e InvalidUriError) Error() string
func (InvalidUriError) Temporary ¶
func (e InvalidUriError) Temporary() bool
func (InvalidUriError) Timeout ¶
func (e InvalidUriError) Timeout() bool
type IvalidPeerPublicKey ¶
type IvalidPeerPublicKey struct {
Text string
}
func (IvalidPeerPublicKey) Error ¶
func (e IvalidPeerPublicKey) Error() string
func (IvalidPeerPublicKey) Temporary ¶
func (e IvalidPeerPublicKey) Temporary() bool
func (IvalidPeerPublicKey) Timeout ¶
func (e IvalidPeerPublicKey) Timeout() bool
type ProtoVersion ¶
ProtoVersion is the representation of yggdrasil protocol semantic version.
func PROTO_VERSION ¶
func PROTO_VERSION() ProtoVersion
Returns current supported version of yggdrasil protocol
func (ProtoVersion) String ¶
func (e ProtoVersion) String() string
type Transport ¶
type Transport interface { // Returns URI scheme of current transport. // As example "tcp" or "tls". GetScheme() string // Establishes and returns a transport connection or returns an error. Connect( ctx context.Context, uri url.URL, proxy *url.URL, key ed25519.PrivateKey, ) (ConnResult, error) // Returns listener object for accepting incoming transport connections. Listen(ctx context.Context, uri url.URL, key ed25519.PrivateKey) (TransportListener, error) }
Abstract interface for all transports realisations like tcp/tls/etc.
type TransportListener ¶
type TransportListener interface { // Accept waits for and returns the next connection to the listener. Accept() (net.Conn, error) // AcceptConn waits for and returns the next connection // with optional transport key to the listener. AcceptConn() (ConnResult, error) // Close closes the listener. // Any blocked Accept operations will be unblocked and return errors. Close() error // Addr returns the listener's network address. Addr() net.Addr }
TransportListener is similar to net.Listener except extra "AcceptConn" metod.
func ListenerToTransportListener ¶
func ListenerToTransportListener(linstener net.Listener, secLvl uint) TransportListener
Wraps regular net.Listener to TransportListener.
type TransportSecurityCheckError ¶
func (TransportSecurityCheckError) Error ¶
func (e TransportSecurityCheckError) Error() string
func (TransportSecurityCheckError) Temporary ¶
func (e TransportSecurityCheckError) Temporary() bool
func (TransportSecurityCheckError) Timeout ¶
func (e TransportSecurityCheckError) Timeout() bool
type UnacceptableAddressError ¶
type UnacceptableAddressError struct {
Text string
}
func (UnacceptableAddressError) Error ¶
func (e UnacceptableAddressError) Error() string
func (UnacceptableAddressError) Temporary ¶
func (e UnacceptableAddressError) Temporary() bool
func (UnacceptableAddressError) Timeout ¶
func (e UnacceptableAddressError) Timeout() bool
type UnknownProtoError ¶
type UnknownProtoError struct{}
func (UnknownProtoError) Error ¶
func (e UnknownProtoError) Error() string
func (UnknownProtoError) Temporary ¶
func (e UnknownProtoError) Temporary() bool
func (UnknownProtoError) Timeout ¶
func (e UnknownProtoError) Timeout() bool
type UnknownProtoVersionError ¶
type UnknownProtoVersionError struct { Expected ProtoVersion Received ProtoVersion }
func (UnknownProtoVersionError) Error ¶
func (e UnknownProtoVersionError) Error() string
func (UnknownProtoVersionError) Temporary ¶
func (e UnknownProtoVersionError) Temporary() bool
func (UnknownProtoVersionError) Timeout ¶
func (e UnknownProtoVersionError) Timeout() bool
type UnknownSchemeError ¶
type UnknownSchemeError struct {
Scheme string
}
func (UnknownSchemeError) Error ¶
func (e UnknownSchemeError) Error() string
func (UnknownSchemeError) Temporary ¶
func (e UnknownSchemeError) Temporary() bool
func (UnknownSchemeError) Timeout ¶
func (e UnknownSchemeError) Timeout() bool