config

package
v1.0.12 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2022 License: MIT Imports: 17 Imported by: 1

Documentation

Index

Constants

View Source
const SimpleSecretLength = 16

Variables

View Source
var C = Config{}

Functions

func Init

func Init(options ...Opt) error

func InitPublicAddress

func InitPublicAddress(ctx context.Context) error

func Printable

func Printable() interface{}

Types

type Config

type Config struct {
	Bind             *net.TCPAddr      `json:"bind"`
	PublicIPv4       *net.TCPAddr      `json:"public_ipv4"`        //nolint: tagliatelle
	PublicIPv6       *net.TCPAddr      `json:"public_ipv6"`        //nolint: tagliatelle
	StatsBind        *net.TCPAddr      `json:"stats_bind"`         //nolint: tagliatelle
	StatsdAddr       *net.TCPAddr      `json:"stats_addr"`         //nolint: tagliatelle
	StatsdTagsFormat *statsd.TagFormat `json:"statsd_tags_format"` //nolint: tagliatelle

	StatsNamespace string            `json:"stats_namespace"` //nolint: tagliatelle
	CloakHost      string            `json:"cloak_host"`      //nolint: tagliatelle
	StatsdTags     map[string]string `json:"statsd_tags"`     //nolint: tagliatelle

	WriteBuffer int `json:"write_buffer"` //nolint: tagliatelle
	ReadBuffer  int `json:"read_buffer"`  //nolint: tagliatelle
	CloakPort   int `json:"cloak_port"`   //nolint: tagliatelle

	AntiReplayMaxSize int `json:"anti_replay_max_size"` //nolint: tagliatelle

	MultiplexPerConnection int `json:"multiplex_per_connection"` //nolint: tagliatelle

	Debug      bool       `json:"debug"`
	Verbose    bool       `json:"verbose"`
	SecretMode SecretMode `json:"secret_mode"` //nolint: tagliatelle
	PreferIP   PreferIP   `json:"prefer_ip"`   //nolint: tagliatelle
	NTPServers []string   `json:"ntp_servers"` //nolint: tagliatelle

	Secret []byte `json:"secret"`
	AdTag  []byte `json:"adtag"`
}

func (*Config) ClientReadBuffer added in v1.0.5

func (c *Config) ClientReadBuffer() int

func (*Config) ClientWriteBuffer added in v1.0.5

func (c *Config) ClientWriteBuffer() int

func (*Config) MiddleProxyMode added in v1.0.5

func (c *Config) MiddleProxyMode() bool

func (*Config) ProxyReadBuffer added in v1.0.5

func (c *Config) ProxyReadBuffer() int

func (*Config) ProxyWriteBuffer added in v1.0.5

func (c *Config) ProxyWriteBuffer() int

type IPURLs

type IPURLs struct {
	IPv4      *URLs  `json:"ipv4,omitempty"`
	IPv6      *URLs  `json:"ipv6,omitempty"`
	BotSecret string `json:"secret_for_mtproxybot"` //nolint: tagliatelle
}

func GetURLs

func GetURLs() IPURLs

type Opt

type Opt struct {
	Option OptionType
	Value  interface{}
}

type OptionType

type OptionType uint8
const (
	OptionTypeDebug OptionType = iota
	OptionTypeVerbose

	OptionTypePreferIP

	OptionTypeBind
	OptionTypePublicIPv4
	OptionTypePublicIPv6

	OptionTypeStatsBind
	OptionTypeStatsNamespace
	OptionTypeStatsdAddress
	OptionTypeStatsdTagsFormat
	OptionTypeStatsdTags

	OptionTypeWriteBufferSize
	OptionTypeReadBufferSize

	OptionTypeCloakPort

	OptionTypeAntiReplayMaxSize

	OptionTypeMultiplexPerConnection

	OptionTypeNTPServers

	OptionTypeSecret
	OptionTypeAdtag
)

type PreferIP added in v1.0.3

type PreferIP uint8
const (
	PreferIPv4 PreferIP = iota
	PreferIPv6
)

type SecretMode

type SecretMode uint8
const (
	SecretModeSimple SecretMode = iota
	SecretModeSecured
	SecretModeTLS
)

func (SecretMode) String

func (s SecretMode) String() string

type URLs

type URLs struct {
	TG        string `json:"tg_url"`     //nolint: tagliatelle
	TMe       string `json:"tme_url"`    //nolint: tagliatelle
	TGQRCode  string `json:"tg_qrcode"`  //nolint: tagliatelle
	TMeQRCode string `json:"tme_qrcode"` //nolint: tagliatelle
}

Jump to

Keyboard shortcuts

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