cli

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2026 License: MIT Imports: 20 Imported by: 0

Documentation

Overview

Package cli implements the socat command-line interface.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run added in v1.0.1

func Run(args []string, signalExit func(int)) int

Run runs socat with the given args (excluding program name). signalExit is owned by cmd/socat so tests can exercise signal handling without terminating the test process.

Types

type Config

type Config struct {
	Help         int // 0 none, 1 -h, 2 -hh, 3 -hhh
	Version      bool
	LogLevel     logx.Level
	LogDest      LogDest
	LogFile      string
	LogFacility  string
	DumpFDs      bool
	Progname     string
	Micros       bool
	Hostname     bool
	Verbose      bool
	Hex          bool
	BlockSize    int
	Linger       time.Duration
	Idle         time.Duration // <0 infinite, 0 zero, >0 timeout
	IdleSet      bool
	LeftToRight  bool // -u
	RightToLeft  bool // -U
	IP4          bool
	IP6          bool
	IPAny        bool
	Statistics   bool
	Experimental bool
	LockFile     string
	LockWait     string

	RawLeft       string // -r
	RawRight      string // -R
	SignalLogMask uint64 // -S: signals whose termination is logged
	Addresses     []string
	// contains filtered or unexported fields
}

Config holds parsed CLI flags. Per-session peer, child wait status, and dump files live on xio.Global after buildGlobal; this struct is not mutated once parsing finishes.

func ParseArgs

func ParseArgs(args []string) (*Config, error)

ParseArgs parses os.Args-style arguments (without program name).

type LogDest added in v1.0.3

type LogDest int

LogDest is the active diagnostic destination. The last -ls/-lf/-ly/-lm option on the command line wins.

const (
	LogDestStderr LogDest = iota
	LogDestFile
	LogDestSyslog
	LogDestMixed
)

Jump to

Keyboard shortcuts

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