package typesimport (amarpc)constCmdRotateDbg = "rotate-dbg"typeOutputFuncfunc(msg string, args ...any)// nolint:llltypeCliArgsstruct { 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"` OutputMach bool`arg:"--output-mach" default:"true" help:"Export serialized machines as YAML into dir/machs/id.yml and dir/machs/id.schema.yml"` OutputClients bool`arg:"--output-clients" help:"Write a plain text client list into clients.txt inside --dir"`}// 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 tunneled REPLs' 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"typeArgsstruct {am.ArgsBase`json:"-"`}func (Args) () string {returnAPrefix}// ----- TODO per-state args// A is a struct for node arguments. It's a typesafe alternative to [am.A].typeAstruct {Args`json:"-"` 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 {Args`json:"-"` Id string`log:"id"` Addr string`log:"addr"`}// ----- RPC boilerplatefunc init() {for , := rangeArgsRpc {gob.Register() }}// ArgsRpc will be available in the REPL.varArgsRpc = []am.ArgsApi{ARpc{}}
The pages are generated with Goldsv0.8.4. (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.