Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( DefaultTimeout = 30 * time.Second DefaultFilter = Filter(nil) )
Functions ¶
This section is empty.
Types ¶
type Filter ¶ added in v0.4.0
A Filter for identities that are established during a handshake. Although the handshake may be successful, the actual identity may want to be rejected because of some application-level logic. Filters are a hook for implementing such logic.
type GCMSession ¶ added in v0.4.0
type GCMSession struct {
// contains filtered or unexported fields
}
func (GCMSession) Decrypt ¶ added in v0.4.0
func (session GCMSession) Decrypt(p []byte) ([]byte, error)
func (GCMSession) Encrypt ¶ added in v0.4.0
func (session GCMSession) Encrypt(p []byte) ([]byte, error)
func (GCMSession) RemoteSignatory ¶ added in v0.4.0
func (session GCMSession) RemoteSignatory() id.Signatory
type Handshaker ¶
type Handshaker interface { // Handshake with a remote server by initiating, and then interactively // completing, a handshake protocol. The remote server is accessed by // reading/writing to the `io.ReaderWriter`. Handshake(ctx context.Context, c net.Conn) (Session, error) // AcceptHandshake from a remote client by waiting for the initiation of, // and then interactively completing, a handshake protocol. The remote // client is accessed by reading/writing to the `io.ReaderWriter`. AcceptHandshake(ctx context.Context, c net.Conn) (Session, error) }
func NewECDSA ¶ added in v0.4.0
func NewECDSA(opts Options) Handshaker
NewECDSA returns a new Handshaker that uses ECDSA to establish a connection that is authenticated and encrypted using GCM.
func NewInsecure ¶ added in v0.4.0
func NewInsecure(opts Options) Handshaker
NewInsecure returns a new Handshaker that implements no authentication, encryption, or restrictions on connections.
type Options ¶ added in v0.4.0
type Options struct { Logger logrus.FieldLogger PrivKey *ecdsa.PrivateKey Timeout time.Duration Filter Filter }
func DefaultOptions ¶ added in v0.4.0
func DefaultOptions() Options
func (Options) WithFilter ¶ added in v0.4.0
func (Options) WithLogger ¶ added in v0.4.0
func (opts Options) WithLogger(logger logrus.FieldLogger) Options
func (Options) WithPrivKey ¶ added in v0.4.0
func (opts Options) WithPrivKey(privKey *ecdsa.PrivateKey) Options
type Session ¶ added in v0.4.0
type Session interface { // Encrypt data for the other Signatory. Encrypt([]byte) ([]byte, error) // Decrypt data from the other Signatory. Decrypt([]byte) ([]byte, error) // RemoteSignatory returns the pubkey hash of the Signatory that is on the // remote end of the Session. RemoteSignatory() id.Signatory }
Click to show internal directories.
Click to hide internal directories.