controller

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Jan 1, 2023 License: MIT Imports: 39 Imported by: 0

Documentation

Overview

Package generate the InbounderConfig used by add inbound

Index

Constants

This section is empty.

Variables

Functions

func InboundBuilder

func InboundBuilder(config *Config, nodeInfo *api.NodeInfo, tag string) (*core.InboundHandlerConfig, error)

InboundBuilder build Inbound config for different protocol

func OutboundBuilder

func OutboundBuilder(config *Config, nodeInfo *api.NodeInfo, tag string) (*core.OutboundHandlerConfig, error)

OutboundBuilder build freedom outbund config for addoutbound

func TransitBuilder

func TransitBuilder(config *Config, nodeInfo *api.TransitNodeInfo, tag string, UUID string, Email string, Passwd string, UID int) (*core.OutboundHandlerConfig, error)

Types

type Address

type Address struct {
	net.Address
}

func (*Address) Build

func (v *Address) Build() *net.IPOrDomain

func (*Address) UnmarshalJSON

func (v *Address) UnmarshalJSON(data []byte) error

type CertConfig

type CertConfig struct {
	CertMode   string            `mapstructure:"CertMode"` // none, file, http, dns
	CertDomain string            `mapstructure:"CertDomain"`
	CertFile   string            `mapstructure:"CertFile"`
	KeyFile    string            `mapstructure:"KeyFile"`
	Provider   string            `mapstructure:"Provider"` // alidns, cloudflare, gandi, godaddy....
	Email      string            `mapstructure:"Email"`
	DNSEnv     map[string]string `mapstructure:"DNSEnv"`
}

type Config

type Config struct {
	SendIP               string            `mapstructure:"SendIP"`
	CertConfig           *CertConfig       `mapstructure:"CertConfig"`
	EnableDNS            bool              `mapstructure:"EnableDNS"`
	DNSType              string            `mapstructure:"DNSType"`
	DisableUploadTraffic bool              `mapstructure:"DisableUploadTraffic"`
	DisableGetRule       bool              `mapstructure:"DisableGetRule"`
	EnableFallback       bool              `mapstructure:"EnableFallback"`
	DisableIVCheck       bool              `mapstructure:"DisableIVCheck"`
	FallBackConfigs      []*FallBackConfig `mapstructure:"FallBackConfigs"`
}

type Controller

type Controller struct {
	Tag        string
	TransitTag string
	Rtag       bool
	// contains filtered or unexported fields
}

func New

func New(server *core.Instance, api api.API, config *Config) *Controller

New return a Controller service with default parameters.

func (*Controller) AddInboundLimiter

func (c *Controller) AddInboundLimiter(tag string, nodeSpeedLimit uint64, userList *[]api.UserInfo) error

func (*Controller) AddUserRoutingRule

func (c *Controller) AddUserRoutingRule(tag string, email []string)

func (*Controller) Close

func (c *Controller) Close() error

Close implement the Close() function of the service interface

func (*Controller) DeleteInboundLimiter

func (c *Controller) DeleteInboundLimiter(tag string) error

func (*Controller) GetDetectResult

func (c *Controller) GetDetectResult(tag string) (*[]api.DetectResult, error)

func (*Controller) GetOnlineDevice

func (c *Controller) GetOnlineDevice(tag string) (*[]api.OnlineUser, error)

func (*Controller) RemoveUserRoutingRule

func (c *Controller) RemoveUserRoutingRule(email []string)

func (*Controller) Start

func (c *Controller) Start() error

Start implement the Start() function of the service interface

func (*Controller) Transit

func (c *Controller) Transit(newTransitNodeInfo *api.TransitNodeInfo, userInfo *[]api.UserInfo) (err error)

func (*Controller) UpdateInboundLimiter

func (c *Controller) UpdateInboundLimiter(tag string, updatedUserList *[]api.UserInfo) error

func (*Controller) UpdateRule

func (c *Controller) UpdateRule(tag string, newRuleList []api.DetectRule) error

type FallBackConfig

type FallBackConfig struct {
	SNI              string `mapstructure:"SNI"`
	Path             string `mapstructure:"Path"`
	Dest             string `mapstructure:"Dest"`
	ProxyProtocolVer uint64 `mapstructure:"ProxyProtocolVer"`
}

type OutboundDetourConfig

type OutboundDetourConfig struct {
	Protocol      string             `json:"protocol"`
	SendThrough   *conf.Address      `json:"sendThrough"`
	Tag           string             `json:"tag"`
	Settings      *json.RawMessage   `json:"settings"`
	StreamSetting *conf.StreamConfig `json:"streamSettings"`
	ProxySettings *conf.ProxyConfig  `json:"proxySettings"`
	MuxSettings   *conf.MuxConfig    `json:"mux"`
}

func (*OutboundDetourConfig) Build

Build implements Buildable.

type ShadowsocksClientConfig

type ShadowsocksClientConfig struct {
	Servers []*ShadowsocksServerTarget `json:"servers"`
}

func (*ShadowsocksClientConfig) Build

type ShadowsocksServer

type ShadowsocksServer struct {
	Address  string `json:"address"`
	Port     uint16 `json:"port"`
	Cipher   string `json:"method"`
	Password string `json:"password"`
	Email    string `json:"email"`
	Level    byte   `json:"level"`
	IVCheck  bool   `json:"ivCheck"`
}

type ShadowsocksServerTarget

type ShadowsocksServerTarget struct {
	Address  *Address `json:"address"`
	Port     uint16   `json:"port"`
	Cipher   string   `json:"method"`
	Password string   `json:"password"`
	Email    string   `json:"email"`
	Level    byte     `json:"level"`
	IVCheck  bool     `json:"ivCheck"`
	UoT      bool     `json:"uot"`
}

type TrojanClientConfig

type TrojanClientConfig struct {
	Servers []*TrojanServerTarget `json:"servers"`
}

func (*TrojanClientConfig) Build

func (c *TrojanClientConfig) Build() (proto.Message, error)

type TrojanServer

type TrojanServer struct {
	Address  string `json:"address"`
	Port     uint16 `json:"port"`
	Password string `json:"password"`
	Email    string `json:"email"`
	Level    byte   `json:"level"`
	Flow     string `json:"flow"`
}

type TrojanServerTarget

type TrojanServerTarget struct {
	Address  *Address `json:"address"`
	Port     uint16   `json:"port"`
	Password string   `json:"password"`
	Email    string   `json:"email"`
	Level    byte     `json:"level"`
	Flow     string   `json:"flow"`
}

type VLessOutbound

type VLessOutbound struct {
	Address string            `json:"address"`
	Port    uint16            `json:"port"`
	Users   []json.RawMessage `json:"users"`
}

type VLessOutboundConfig

type VLessOutboundConfig struct {
	Vnext []*VLessOutboundVnext `json:"vnext"`
}

func (*VLessOutboundConfig) Build

func (c *VLessOutboundConfig) Build() (proto.Message, error)

type VLessOutboundVnext

type VLessOutboundVnext struct {
	Address *Address          `json:"address"`
	Port    uint16            `json:"port"`
	Users   []json.RawMessage `json:"users"`
}

type VMessAccount

type VMessAccount struct {
	ID          string `json:"id"`
	AlterIds    uint16 `json:"alterId"`
	Security    string `json:"security"`
	Experiments string `json:"experiments"`
}

func (*VMessAccount) Build

func (a *VMessAccount) Build() *vmess.Account

type VMessOutbound

type VMessOutbound struct {
	Address string            `json:"address"`
	Port    uint16            `json:"port"`
	Users   []json.RawMessage `json:"users"`
}

type VMessOutboundConfig

type VMessOutboundConfig struct {
	Receivers []*VMessOutboundTarget `json:"vnext"`
}

func (*VMessOutboundConfig) Build

func (c *VMessOutboundConfig) Build() (proto.Message, error)

type VMessOutboundTarget

type VMessOutboundTarget struct {
	Address *Address          `json:"address"`
	Port    uint16            `json:"port"`
	Users   []json.RawMessage `json:"users"`
}

Jump to

Keyboard shortcuts

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