Documentation
¶
Index ¶
- Constants
- type SecureSession
- func (ss *SecureSession) Close() error
- func (ss *SecureSession) ConnectRequest() ([]byte, error)
- func (ss *SecureSession) GetRemoteID() ([]byte, error)
- func (ss *SecureSession) GetRemoteId() ([]byte, error)deprecated
- func (ss *SecureSession) GetState() int
- func (ss *SecureSession) Unwrap(data []byte) ([]byte, bool, error)
- func (ss *SecureSession) Wrap(data []byte) ([]byte, error)
- type SessionCallbacks
Constants ¶
const ( StateIdle = iota StateNegotiating StateEstablished )
Secure Session states.
const ( STATE_IDLE = StateIdle STATE_NEGOTIATING = StateNegotiating STATE_ESTABLISHED = StateEstablished )
Secure Session states.
Deprecated: Since 0.11. Use "session.State..." constants instead.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SecureSession ¶
type SecureSession struct {
// contains filtered or unexported fields
}
SecureSession is a lightweight mechanism for securing any kind of network communication (both private and public networks, including the Internet). It is protocol-agnostic and operates on the 5th layer of the network OSI model (the session layer).
func New ¶
func New(id []byte, signKey *keys.PrivateKey, callbacks SessionCallbacks) (*SecureSession, error)
New makes a new Secure Session with provided peer ID, private key, and callbacks.
func (*SecureSession) Close ¶
func (ss *SecureSession) Close() error
Close destroys a Secure Session.
func (*SecureSession) ConnectRequest ¶
func (ss *SecureSession) ConnectRequest() ([]byte, error)
ConnectRequest generates a connection request that must be sent to the remote peer.
func (*SecureSession) GetRemoteID ¶
func (ss *SecureSession) GetRemoteID() ([]byte, error)
GetRemoteID returns ID of the remote peer.
func (*SecureSession) GetRemoteId
deprecated
func (ss *SecureSession) GetRemoteId() ([]byte, error)
GetRemoteId returns ID of the remote peer.
Deprecated: Since 0.11. Use GetRemoteID() instead.
func (*SecureSession) GetState ¶
func (ss *SecureSession) GetState() int
GetState returns current state of Secure Session.
type SessionCallbacks ¶
type SessionCallbacks interface {
GetPublicKeyForId(ss *SecureSession, id []byte) *keys.PublicKey
StateChanged(ss *SecureSession, state int)
}
SessionCallbacks implements a delegate for SecureSession.