config

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DnsCache = dns.New(time.Minute, dns.PolicyOption(dns.PolicyRandom))

	// App default config
	App = &Config{
		Inbound: &Server{
			Host:    "0.0.0.0",
			Port:    1080,
			Timeout: 30 * time.Second,
			TLSConf: &tls.Config{
				MinVersion: tls.VersionTLS13,
			},
		},
		Dashboard: &Server{
			Timeout: 30 * time.Second,
			TLSConf: &tls.Config{
				MinVersion: tls.VersionTLS13,
			},
		},
		Outbound: &Server{
			Timeout: 30 * time.Second,
			TLSConf: &tls.Config{
				MinVersion: tls.VersionTLS13,
			},
		},
		Host: make(map[string][]string),
		Log: &Log{
			Level:      "info",
			MaxBackups: 7,
			MaxSize:    500,
			MaxAge:     28,
			Compress:   true,
		},
	}
)

Functions

func Load

func Load(filePath string) error

Types

type Config

type Config struct {
	Inbound   *Server             `yaml:"Inbound"`
	Dashboard *Server             `yaml:"Dashboard"`
	Outbound  *Server             `yaml:"Outbound"`
	Host      map[string][]string `json:"Host"`
	Log       *Log                `yaml:"Log"`
}

type Log

type Log struct {
	Level      string `yaml:"Level"`
	File       string `yaml:"File"`
	MaxBackups int    `yaml:"MaxBackups"`
	MaxSize    int    `yaml:"MaxSize"`
	MaxAge     int    `yaml:"MaxAge"`
	Compress   bool   `yaml:"Compress"`
}

type Server added in v1.0.4

type Server struct {
	Host      string        `yaml:"Host"`
	Port      int64         `yaml:"Port"`
	Token     string        `yaml:"Token"`
	Timeout   time.Duration `yaml:"Timeout"`
	Interface string        `yaml:"Interface"`
	Static    string        `yaml:"Static"` // server inbound only
	Pac       string        `json:"Pac"`    // client inbound only
	TLS       *TLS          `yaml:""`       // 证书

	// 证书
	TLSConf *tls.Config
}

func (*Server) Addr added in v1.0.4

func (s *Server) Addr() string

func (*Server) Enable added in v1.0.4

func (s *Server) Enable() bool

type TLS added in v1.0.4

type TLS struct {
	Enable      bool   `yaml:""`
	ServerName  string `yaml:""`
	Key         string `yaml:""`
	Cert        string `yaml:""`
	Fingerprint string `yaml:""`
}

Jump to

Keyboard shortcuts

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