handshake

package
v0.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 9, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUnexpectedPayload       = HandshakeError{/* contains filtered or unexported fields */}
	ErrDeadlineExceeded        = HandshakeError{/* contains filtered or unexported fields */}
	ErrInvalidCredentials      = HandshakeError{/* contains filtered or unexported fields */}
	ErrPeerDeclinedCredentials = HandshakeError{Err: errors.New("remote peer declined the credentials")}
	ErrSkipVerifyNotAllowed    = HandshakeError{/* contains filtered or unexported fields */}
	ErrUnexpected              = HandshakeError{/* contains filtered or unexported fields */}

	ErrIncompatibleVersion     = HandshakeError{/* contains filtered or unexported fields */}
	ErrIncompatibleProto       = HandshakeError{/* contains filtered or unexported fields */}
	ErrRemoteIncompatibleProto = HandshakeError{Err: errors.New("remote peer declined the proto")}

	ErrGotUnexpectedMessage = errors.New("go not a handshake message")
)

Functions

func IncomingHandshake

func IncomingHandshake(ctx context.Context, conn io.ReadWriteCloser, peerId string, cc CredentialChecker) (identity []byte, err error)

func IncomingProtoHandshake added in v0.2.0

func IncomingProtoHandshake(ctx context.Context, conn net.Conn, pt ProtoChecker) (protoType handshakeproto.ProtoType, err error)

func OutgoingHandshake

func OutgoingHandshake(ctx context.Context, conn io.ReadWriteCloser, peerId string, cc CredentialChecker) (identity []byte, err error)

func OutgoingProtoHandshake added in v0.2.0

func OutgoingProtoHandshake(ctx context.Context, conn net.Conn, pt handshakeproto.ProtoType) (err error)

Types

type CredentialChecker

type CredentialChecker interface {
	MakeCredentials(remotePeerId string) *handshakeproto.Credentials
	CheckCredential(remotePeerId string, cred *handshakeproto.Credentials) (identity []byte, err error)
}

type HandshakeError

type HandshakeError struct {
	Err error
	// contains filtered or unexported fields
}

func (HandshakeError) Error

func (he HandshakeError) Error() string

type ProtoChecker added in v0.2.0

type ProtoChecker struct {
	AllowedProtoTypes []handshakeproto.ProtoType
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL