config

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2023 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	App = new(Config)
)

Functions

func Init

func Init(dir string) error

Init prepare necessary files

func Load

func Load(changeCh chan bool) error

Types

type Config

type Config struct {
	Inbound    *Inbound
	Outbound   *Outbound
	Controller *Controller
	Tun        *Tun
	DNS        *DNS
	Hosts      *trie.DomainTrie
	Users      []auth.AuthUser
	Whitelist  []net.IP
	Log        *Log
}

type Controller

type Controller struct {
	Enable bool   `yaml:",default=false"`
	Listen string `yaml:",default=0.0.0.0"`
	Port   int    `yaml:",default=8080"`
	Secret string `yaml:""`
}

type DNS

type DNS struct {
	Enable      bool             `yaml:""`
	NameServers []dns.NameServer `yaml:""`
	Listen      string           `yaml:""`
	Port        int              `yaml:""`
	Hosts       *trie.DomainTrie
}

type Inbound

type Inbound struct {
	Listen string `yaml:",default=0.0.0.0"`
	Port   int    `yaml:",default=8090"`
}

Inbound config

type ListenPrefix added in v1.0.3

type ListenPrefix netip.Prefix

func (ListenPrefix) Build added in v1.0.3

func (p ListenPrefix) Build() netip.Prefix

func (ListenPrefix) MarshalYAML added in v1.0.3

func (p ListenPrefix) MarshalYAML() (interface{}, error)

func (*ListenPrefix) UnmarshalYAML added in v1.0.3

func (p *ListenPrefix) UnmarshalYAML(node *yaml.Node) error

type Log

type Log struct {
	Output     *lumberjack.Logger `json:"-" yaml:"-"`
	Filename   string             `yaml:""`
	Level      string             `yaml:",default=info"`
	MaxBackups int                `yaml:",default=7"`
	MaxSize    int                `yaml:",default=500"`
	MaxAge     int                `yaml:",default=28"`
	Compress   bool               `yaml:",default=true"`
}

type Outbound added in v1.0.2

type Outbound struct {
	Interface   string `yaml:""`
	RoutingMark int    `yaml:""`
}

type RawConfig

type RawConfig struct {
	Inbound    *Inbound          `yaml:""`
	Outbound   *Outbound         `yaml:""`
	Tun        *Tun              `yaml:""`
	Controller *Controller       `yaml:""`
	Auth       map[string]string `yaml:""`
	Hosts      map[string]string `yaml:""`
	DNS        RawDNS            `yaml:""`
	Log        *Log              `yaml:""`
	WhiteList  []string          `yaml:""`
}

func (*RawConfig) Parse added in v1.0.2

func (c *RawConfig) Parse() error

type RawDNS

type RawDNS struct {
	Enable      bool     `yaml:",default=true"`
	NameServers []string `yaml:",default=8.8.8.8"`
	Listen      string   `yaml:",default=0.0.0.0"`
	Port        int      `yaml:",default=53"`
}

type Tun added in v1.0.3

type Tun struct {
	Enable            bool           `yaml:",default=false"`
	Stack             string         `yaml:",default=system"`
	DNSHijack         []string       `yaml:""`
	Inet4Address      []ListenPrefix `yaml:"-"`
	Inet4RouteAddress []ListenPrefix `yaml:"-"`
}

Jump to

Keyboard shortcuts

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