docs(handler/serial): add comprehensive English comments to all files
Add package-level architecture documentation describing two modes (hop-based forwarding and direct proxy), two-tier dialing strategy in forwardSerial, recorderConn per-packet logging with direction convention, and metadata parsing details. No code changes.
This commit is contained in:
@@ -7,10 +7,19 @@ import (
|
||||
mdutil "github.com/go-gost/x/metadata/util"
|
||||
)
|
||||
|
||||
// metadata holds the parsed configuration for the serial handler.
|
||||
// It is populated from the handler's metadata map during Init().
|
||||
type metadata struct {
|
||||
// timeout is the per-read timeout applied when opening a serial port
|
||||
// directly (not through the router chain). It controls how long the
|
||||
// serial port blocks waiting for data before returning to the caller.
|
||||
// A value of 0 means blocking indefinitely (no timeout).
|
||||
timeout time.Duration
|
||||
}
|
||||
|
||||
// parseMetadata extracts typed configuration from the generic metadata map.
|
||||
// Supported keys: "timeout", "serial.timeout" (both accept duration strings
|
||||
// like "5s" or integer seconds).
|
||||
func (h *serialHandler) parseMetadata(md mdata.Metadata) (err error) {
|
||||
h.md.timeout = mdutil.GetDuration(md, "timeout", "serial.timeout")
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user