package typesimport (amhelpamarpc)constCmdRotateDbg = "rotate-dbg"typeOutputFuncfunc(msg string, args ...any)// nolint:llltypeArgsstruct { RotateDbg *ArgsRotateDbg`arg:"subcommand:rotate-dbg" help:"Rotate dbg protocol with fragmented dump files"` Wasm *ArgsWasm`arg:"subcommand:wasm" help:"WebSockets to local TCP listeners for WASM"` Debug bool`arg:"--debug" help:"Enable debugging for asyncmachine"` Name string`arg:"-n,--name" help:"Name of this relay"` Output OutputFunc`arg:"-"` Parent am.Api`arg:"-"` Version bool`arg:"-v,--version" help:"Print version and exit"`}// ArgsRotateDbg converts dbg dumps to other formats / versions.// am-relay convert-dbg am-dbg-dump.gob.br -o am-vis// nolint:llltypeArgsRotateDbgstruct { ListenAddr string`arg:"-l,--listen-addr" default:"localhost:12732" help:"Listen address for the RPC server"` FwdAddr []string`arg:"-f,--fwd-addr,separate" help:"Address of an RPC server to forward data to (repeatable)"` IntervalTx int`arg:"--interval-tx" default:"10000" help:"Amount of transitions to create a dump file"` IntervalTime time.Duration`arg:"--interval-duration" default:"24h" help:"Amount of human time to create a dump file"` Filename string`arg:"-o,--output" default:"am-dbg-dump" help:"Output file base name"` Dir string`arg:"-d,--dir" default:"." help:"Output directory"`}// ArgsWasm// nolint:llltypeArgsWasmstruct { ListenAddr string`arg:"-l,--listen-addr" default:"localhost:12733" help:"Listen address for HTTP server"` StaticDir string`arg:"-s,--static-dir" help:"Directory with static files to serve (optional)"` ReplAddrDir string`arg:"-r,--repl-addr-dir" help:"Directory for creating REPL addr files (optional)"`// Match incoming tunnels by mach IDs and pass directly to new RPC clients TunnelMatchers []TunnelMatcher`arg:"-"`// Match incoming TCP dials by mach IDs and pass directly to new RPC servers DialMatchers []DialMatcher`arg:"-"`}typeDialMatcherstruct { Id *regexp.Regexp NewServer NewServerFunc}typeNewServerFuncfunc( ctx context.Context, id string, conn net.Conn,) (*arpc.Server, error)typeTunnelMatcherstruct { Id *regexp.Regexp NewClient NewClientFunc}typeNewClientFuncfunc( ctx context.Context, id string, conn net.Conn,) (*arpc.Client, error)// ///// ///// /////// ///// ARGS// ///// ///// /////constAPrefix = "relay"// A is a struct for node arguments. It's a typesafe alternative to [am.A].typeAstruct { Id string`log:"id"` Addr string`log:"addr"` RemoteAddr string`log:"remote_addr"`// non-rpc fields Conn net.Conn}// ARpc is a subset of A, that can be passed over RPC.typeARpcstruct { Id string`log:"id"` Addr string`log:"addr"`}// ParseArgs extracts A from [am.Event.Args][APrefix].func ( am.A) *A {if , := [APrefix].(*ARpc); {returnamhelp.ArgsToArgs(, &A{}) } elseif , := [APrefix].(ARpc); {returnamhelp.ArgsToArgs(&, &A{}) }if , := [APrefix].(*A); != nil {return }return &A{}}// Pass prepares [am.A] from A to pass to further mutations.func ( *A) am.A {returnam.A{APrefix: }}// PassRpc prepares [am.A] from A to pass over RPC.func ( *ARpc) am.A {returnam.A{APrefix: amhelp.ArgsToArgs(, &ARpc{})}}// LogArgs is an args logger for A.func ( am.A) map[string]string { := ParseArgs()if == nil {returnnil }returnamhelp.ArgsToLogMap(, 0)}
The pages are generated with Goldsv0.8.2. (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu.
PR and bug reports are welcome and can be submitted to the issue list.
Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds.