protocols

package
v0.3.10 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// All package errors are wrapping Error
	Error = errorFlag("protocols: error")
	OK    = errorFlag("protocols: OK") // error wrapping OK are used to signal protocol completion.

)

Variables

This section is empty.

Functions

func IsError

func IsError(err error) bool

IsError test if err is not protocols.OK

func Run

func Run[S any](ctx context.Context, fsm Fsm[S], tr transport.Transport) error

Run reads & writes messages from/to Transport and executes protocol until completion.

Types

type ExitFunc

type ExitFunc[S any] func(S, error) error

ExitFunc is called at protocol completion using protocol run error status.

type Fsm

type Fsm[S any] interface {
	State() (S, StateFunc[S])
	SetState(sf StateFunc[S])
	ExitHandler() ExitFunc[S]
	SetExitHandler(ef ExitFunc[S])
	Initiator() bool
}

Fsm exposes protocol state S.

type StateFunc

type StateFunc[S any] func(context.Context, S, []byte) (StateFunc[S], []byte, error)

StateFunc changes state S using incoming []byte message. It returns next StateFunc and a message to be forwarded to connected peer. To report protocol completion StateFunc returns an error wrapping protocols.OK.

Directories

Path Synopsis
Package enroll provides client & server implementation of KerPass Enrollment protocol.
Package enroll provides client & server implementation of KerPass Enrollment protocol.

Jump to

Keyboard shortcuts

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