handshake

package
v0.4.25 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2024 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 IncomingProtoHandshake added in v0.2.0

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

func OutgoingProtoHandshake added in v0.2.0

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

Types

type CredentialChecker

type CredentialChecker interface {
	MakeCredentials(remotePeerId string) *handshakeproto.Credentials
	CheckCredential(remotePeerId string, cred *handshakeproto.Credentials) (result Result, 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
}

type Result added in v0.2.2

type Result struct {
	Identity      []byte
	ProtoVersion  uint32
	ClientVersion string
}

func IncomingHandshake

func IncomingHandshake(ctx context.Context, conn io.ReadWriteCloser, peerId string, cc CredentialChecker) (result Result, err error)

func OutgoingHandshake

func OutgoingHandshake(ctx context.Context, conn io.ReadWriteCloser, peerId string, cc CredentialChecker) (result Result, err error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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