config

package
v3.0.0-...-c7a00e8 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Log

type Log struct {
	Level log.Level
}

func (Log) MarshalJSON

func (l Log) MarshalJSON() ([]byte, error)

func (*Log) UnmarshalJSON

func (l *Log) UnmarshalJSON(bytes []byte) error

type MinecraftService

type MinecraftService struct {
	EnableHostnameRewrite bool
	RewrittenHostname     string `json:",omitempty"`

	OnlineCount onlineCount

	IgnoreFMLSuffix   bool `json:",omitempty"`
	IgnoreSRVRedirect bool `json:",omitempty"`

	HostnameAccess access `json:",omitempty"`
	NameAccess     access `json:",omitempty"`

	PingMode        string
	MotdFavicon     string
	MotdDescription string
}

type Outbound

type Outbound struct {
	Name                 string                         `json:",omitempty"`
	Dialer               string                         `json:",omitempty"`
	TargetAddress        string                         `json:",omitempty"`
	TargetPort           uint16                         `json:",omitempty"`
	Minecraft            *MinecraftService              `json:",omitempty"`
	SocketOptions        *network.OutboundSocketOptions `json:",omitempty"`
	ProxyProtocolVersion int8                           `json:",omitempty"`
	ProxyOptions         outbound                       `json:",omitempty"`
}

type Root

type Root struct {
	Log       Log
	Services  []*Service
	Router    Router
	Outbounds []*Outbound
	Lists     map[string]set.StringSet
	// contains filtered or unexported fields
}

func LoadConfigFromFile

func LoadConfigFromFile(ctx context.Context, filePath string, watch bool, logger *log.Logger) (*Root, error)

func (*Root) Close

func (r *Root) Close() (err error)

func (*Root) Reload

func (r *Root) Reload() bool

Reload tries to reload the config and returns false if another reloading is on the way. Only takes effect when watcher is enabled.

func (*Root) SetUpdateHandler

func (r *Root) SetUpdateHandler(handler func())

SetUpdateHandler sets a function that would be called after the config reloading.

func (*Root) WatcherEnabled

func (r *Root) WatcherEnabled() bool

type Router

type Router struct {
	DefaultOutbound string  `json:",omitempty"`
	Rules           []*Rule `json:",omitempty"`
}

type Rule

type Rule struct {
	Type      string
	Parameter jsonx.RawJSON `json:",omitempty"`
	//SubRules []Rule `json:",omitempty"`
	Rewrite  RuleRewrite            `json:",omitempty"`
	Sniff    jsonx.Listable[string] `json:",omitempty"`
	Outbound string                 `json:",omitempty"`
	Invert   bool                   `json:",omitempty"`
}

type RuleDomain

type RuleDomain struct {
	Domain       jsonx.Listable[string] `json:",omitempty"`
	DomainSuffix jsonx.Listable[string] `json:",omitempty"`
}

type RuleRewrite

type RuleRewrite struct {
	TargetAddress string                `json:",omitempty"`
	TargetPort    uint16                `json:",omitempty"`
	Minecraft     *ruleRewriteMinecraft `json:",omitempty"`
}

type Service

type Service struct {
	Name          string
	TargetAddress string `json:",omitempty"`
	TargetPort    uint16 `json:",omitempty"`
	Listen        uint16

	EnableProxyProtocol bool                          `json:",omitempty"`
	IPAccess            access                        `json:",omitempty"`
	Minecraft           *MinecraftService             `json:",omitempty"`
	TLSSniffing         *tlsSniffing                  `json:",omitempty"`
	SocketOptions       *network.InboundSocketOptions `json:",omitempty"`
	Outbound            outbound                      `json:",omitempty"`
}

Jump to

Keyboard shortcuts

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