cli

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2026 License: MIT Imports: 40 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Access

type Access struct {
	ConfigPath string `kong:"arg,required,type='existingfile',help='Path to the configuration file.',name='config-path'"`                 //nolint: lll
	PublicIPv4 net.IP `kong:"help='Public IPv4 address for proxy. By default it is resolved via remote website',name='ipv4',short='i'"`   //nolint: lll
	PublicIPv6 net.IP `kong:"help='Public IPv6 address for proxy. By default it is resolved via remote website',name='ipv6',short='I'"`   //nolint: lll
	Port       uint   `kong:"help='Port number. Default port is taken from configuration file, bind-to parameter',type:'uint',short='p'"` //nolint: lll
	Hex        bool   `kong:"help='Print secret in hex encoding.',short='x'"`
}

func (*Access) Run

func (a *Access) Run(cli *CLI, version string) error

type CLI

type CLI struct {
	GenerateSecret GenerateSecret   `kong:"cmd,help='Generate new proxy secret'"`
	Doctor         Doctor           `kong:"cmd,help='Check that proxy can run correctly'"`
	Access         Access           `kong:"cmd,help='Print access information.'"`
	Run            Run              `kong:"cmd,help='Run proxy.'"`
	SimpleRun      SimpleRun        `kong:"cmd,help='Run proxy without config file.'"`
	WebRelay       WebRelay         `kong:"cmd,help='Run the WEB proxy relay for the secrets in a config file.'"`
	GenerateWebKey GenerateWebKey   `kong:"cmd,help='Generate the WEB relay token signing key.'"`
	Version        kong.VersionFlag `kong:"help='Print version.',short='v'"`
}

type Doctor

type Doctor struct {
	ConfigPath      string `kong:"arg,required,type='existingfile',help='Path to the configuration file.',name='config-path'"` //nolint: lll
	SkipNativeCheck bool   ``                                                                                                  //nolint: lll
	/* 167-byte string literal not displayed */
	// contains filtered or unexported fields
}

func (*Doctor) Run

func (d *Doctor) Run(cli *CLI, version string) error

type GenerateSecret

type GenerateSecret struct {
	// hostname is optional now: only the ee (FakeTLS) form carries one on the
	// wire, and GenerateSecretMode rejects the wrong combination with a message
	// that names the mode.
	HostName string `kong:"arg,optional,help='Hostname to use for domain fronting. Required by (and only by) the ee mode.',name='hostname'"` //nolint: lll
	Hex      bool   `kong:"help='Print secret in hex encoding.',short='x'"`
	Mode     string `kong:"name='mode',default='ee',help='Secret wire form: ee (FakeTLS), dd or plain.'"`
}

func (*GenerateSecret) Run

func (g *GenerateSecret) Run(_ *CLI, _ string) error

type GenerateWebKey added in v1.1.0

type GenerateWebKey struct {
	Path string `kong:"arg,required,help='Where to write the 32-byte signing key.',name='path'"`
}

GenerateWebKey writes the relay's token signing key.

It is a command rather than something the relay does on first run, because a key invented at startup works perfectly until the process restarts and then silently breaks the one thing it exists for -- recognising this relay's own tokens after a restart, so they get a local 404 instead of being handed to the cover site.

func (*GenerateWebKey) Run added in v1.1.0

func (g *GenerateWebKey) Run(_ *CLI) error

type Run

type Run struct {
	ConfigPath string `kong:"arg,required,type='existingfile',help='Path to the configuration file.',name='config-path'"` //nolint: lll
}

func (*Run) Run

func (r *Run) Run(cli *CLI, version string) error

type SimpleRun

type SimpleRun struct {
	BindTo string `kong:"arg,required,name='bind-to',help='A host:port to bind proxy to.'"`
	Secret string `kong:"arg,required,name='secret',help='Proxy secret.'"`

	Debug       bool   `kong:"name='debug',short='d',help='Run in debug mode.'"`                                                 //nolint: lll
	Concurrency uint64 `kong:"name='concurrency',short='c',default='8192',help='Max number of concurrent connection to proxy.'"` //nolint: lll
	TCPBuffer   string `kong:"name='tcp-buffer',short='b',default='4KB',help='Deprecated and ignored'"`                          //nolint: lll
	PreferIP    string ``                                                                                                        //nolint: lll
	/* 126-byte string literal not displayed */
	DomainFrontingPort uint64 `kong:"name='domain-fronting-port',short='p',default='443',help='A port to access for domain fronting.'"` //nolint: lll
	DomainFrontingHost string ``                                                                                                        //nolint: lll
	/* 126-byte string literal not displayed */
	DomainFrontingIP string `` //nolint: lll
	/* 149-byte string literal not displayed */
	DOHIP               net.IP        `kong:"name='doh-ip',short='n',default='1.1.1.1',help='IP address of DNS-over-HTTP to use.'"`            //nolint: lll
	Timeout             time.Duration `kong:"name='timeout',short='t',default='10s',help='Network timeout to use'"`                            //nolint: lll
	Socks5Proxies       []string      `kong:"name='socks5-proxy',short='s',help='Socks5 proxies to use for network access.'"`                  //nolint: lll
	AntiReplayCacheSize string        `kong:"name='antireplay-cache-size',short='a',default='1MB',help='A size of anti-replay cache to use.'"` //nolint: lll

	ProxyProtocolListener bool `` //nolint: lll
	/* 162-byte string literal not displayed */
}

func (*SimpleRun) Run

func (s *SimpleRun) Run(cli *CLI, version string) error

type WebRelay added in v1.1.0

type WebRelay struct {
	ConfigPath string `kong:"arg,required,type='existingfile',help='Path to the configuration file.',name='config-path'"` //nolint: lll
	Check      bool   `kong:"help='Verify the [web] configuration and exit without listening.'"`
}

WebRelay serves the WEB proxy v1 carrier for the secrets in a config file.

It is a separate process from the proxy, reading the same file. That is a deliberate shape rather than an accident of packaging: the relay terminates requests from a browser, parses HTTP and WebSocket frames from the open internet, and runs a page's worth of protocol on their behalf. The MTProto port has none of that surface and should not inherit it. They meet at one loopback socket that already exists.

func (*WebRelay) Run added in v1.1.0

func (w *WebRelay) Run(_ *CLI, version string) error

Jump to

Keyboard shortcuts

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