controller

package
v0.7.7-beta.2 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2022 License: MPL-2.0 Imports: 27 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

Types

type CertConfig

type CertConfig struct {
	CertMode         string            `mapstructure:"CertMode"` // none, file, http, dns
	RejectUnknownSni bool              `mapstructure:"RejectUnknownSni"`
	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 {
	ListenIP                string                   `mapstructure:"ListenIP"`
	SendIP                  string                   `mapstructure:"SendIP"`
	UpdatePeriodic          int                      `mapstructure:"UpdatePeriodic"`
	CertConfig              *CertConfig              `mapstructure:"CertConfig"`
	EnableDNS               bool                     `mapstructure:"EnableDNS"`
	DNSType                 string                   `mapstructure:"DNSType"`
	DisableUploadTraffic    bool                     `mapstructure:"DisableUploadTraffic"`
	DisableGetRule          bool                     `mapstructure:"DisableGetRule"`
	EnableProxyProtocol     bool                     `mapstructure:"EnableProxyProtocol"`
	EnableFallback          bool                     `mapstructure:"EnableFallback"`
	DisableIVCheck          bool                     `mapstructure:"DisableIVCheck"`
	DisableSniffing         bool                     `mapstructure:"DisableSniffing"`
	DynamicSpeedLimitConfig *DynamicSpeedLimitConfig `mapstructure:"DynamicSpeedLimitConfig"`
	FallBackConfigs         []*FallBackConfig        `mapstructure:"FallBackConfigs"`
	EnableRedis             bool                     `mapstructure:"EnableIpRedis"`
	RedisConfig             *RedisReportConfig       `mapstructure:"RedisConfig"`
}

type Controller

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

func New

func New(server *core.Instance, api api.API, config *Config, panelType string) *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) 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) Start

func (c *Controller) Start() error

Start implement the Start() function of the service interface

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 DynamicSpeedLimitConfig added in v0.7.1

type DynamicSpeedLimitConfig struct {
	Limit         int `mapstructure:"Limit"` // mbps
	WarnTimes     int `mapstructure:"WarnTimes"`
	LimitSpeed    int `mapstructure:"LimitSpeed"`    // mbps
	LimitDuration int `mapstructure:"LimitDuration"` // minute
}

type FallBackConfig

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

type LimitInfo added in v0.7.0

type LimitInfo struct {
	// contains filtered or unexported fields
}

type RedisReportConfig added in v0.7.6

type RedisReportConfig struct {
	Addr        string `mapstructure:"Addr"`
	Port        int    `mapstructure:"Port"`
	Password    string `mapstructure:"Password"`
	DB          int    `mapstructure:"DB"`
	PoolTimeout int    `mapstructure:"PoolTimeout"`
}

Jump to

Keyboard shortcuts

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