const ( RemoteIDContextKey key = iota DefaultResponseBufferLen = 1024 )View Source
var ( ErrNotAFunction = errors.New("not a function") ErrInvalidArgsCount = errors.New("invalid argument count") ErrInvalidArg = errors.New("invalid argument, either the type doesn't match or is too complex and can't be inspected") ErrClosureDoesNotExist = errors.New("closure does not exist") )View Source
var ( ErrInvalidFunctionCallPath = errors.New("invalid or empty function call path") ErrInvalidReturn = errors.New("invalid return, can only return an error or a value and an error") ErrReturnValueTooComplex = errors.New("invalid return, either the type doesn't match or is too complex and can't be inspected") ErrInvalidArgs = errors.New("invalid arguments, first argument needs to be a context.Context") ErrCannotCallNonFunction = errors.New("can not call non function") )
type Message[T any] struct { Request *T `json:"request"` Response *T `json:"response"` }
type Registry[R, T any] struct { }
Registry exposes local RPCs and implements remote RPCs
NewRegistry creates a new registry
ForRemotes iterates over the list of connected remotes
func (r Registry[R, T]) LinkMessage( ctx context.Context, writeRequest, writeResponse func(b T) error, readRequest, readResponse func() (T, error), marshal func(v any) (T, error), unmarshal func(data T, v any) error, hooks *LinkHooks, ) error
LinkMessage exposes local RPCs and implements remote RPCs via a message-based transport
LinkStream exposes local RPCs and implements remote RPCs via a stream-based transport
type RegistryHooks struct { OnClientConnect func(remoteID string) OnClientDisconnect func(remoteID string) }
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4