rule

package
v1.2.5 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Copyright 2022 gdy, 272288813@qq.com

Copyright 2022 gdy, 272288813@qq.com

Copyright 2022 gdy, 272288813@qq.com

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddRuleToGlobalRuleList

func AddRuleToGlobalRuleList(sync bool, rl ...RelayRule) (string, error)

func AlterRuleInGlobalRuleListByKey

func AlterRuleInGlobalRuleListByKey(key string, rule *RelayRule) (bool, error)

func CheckProxyConflict

func CheckProxyConflict(proxyList *[]base.Proxy, proxyType, listenIP string, listenPort int) error

CheckProxyConflict 冲突检查

func DeleteGlobalRuleByKey

func DeleteGlobalRuleByKey(key string) (bool, error)

func EnableAllRelayRule

func EnableAllRelayRule() error

func GetGlobalEnableProxyCount

func GetGlobalEnableProxyCount() int64

func GetProxyInfo

func GetProxyInfo(p base.Proxy) map[string]string

func GetRelayRuleList

func GetRelayRuleList() (*[]RelayRule, map[string][]RelayRuleProxyInfo)

func GetRelayRulesFromCMD

func GetRelayRulesFromCMD(configureList []string, options *base.RelayRuleOptions) (relayRules *[]RelayRule, err error)

func SetGlobalRelayRules

func SetGlobalRelayRules(rl *[]RelayRule)

Types

type RelayRule

type RelayRule struct {
	Name                     string                `json:"Name"`
	MainConfigure            string                `json:"Mainconfigure"`
	RelayType                string                `json:"RelayType"`
	ListenIP                 string                `json:"ListenIP"`
	ListenPorts              string                `json:"ListenPorts"`
	TargetIP                 string                `json:"TargetIP"`
	TargetPorts              string                `json:"TargetPorts"`
	BalanceTargetAddressList []string              `json:"BalanceTargetAddressList"`
	Options                  base.RelayRuleOptions `json:"Options"`
	SubRuleList              []SubRelayRule        `json:"SubRuleList"`
	From                     string                `json:"From"`
	IsEnable                 bool                  `json:"Enable"`
	// contains filtered or unexported fields
}

func CreateRuleByConfigureAndOptions

func CreateRuleByConfigureAndOptions(name, configureStr string, options base.RelayRuleOptions) (rule *RelayRule, err error)

func DeleteRuleSlice

func DeleteRuleSlice(a []RelayRule, deleteIndex int) []RelayRule

func DisableRelayRuleByKey

func DisableRelayRuleByKey(key string) (*RelayRule, bool, error)

func EnableRelayRuleByKey

func EnableRelayRuleByKey(key string) (*RelayRule, bool, error)

func GetRuleByMainConfigure

func GetRuleByMainConfigure(configStr string) *RelayRule

func (*RelayRule) CreateMainConfigure

func (r *RelayRule) CreateMainConfigure() (configure string)

func (*RelayRule) Disable

func (r *RelayRule) Disable()

func (*RelayRule) Enable

func (r *RelayRule) Enable()

func (*RelayRule) GetProxyCount

func (r *RelayRule) GetProxyCount() int64

type RelayRuleProxyInfo

type RelayRuleProxyInfo struct {
	Proxy              string `json:"Proxy"`
	CurrentConnections int64  `json:"CurrentConnections"`
	TrafficIn          int64  `json:"TrafficIn"`
	TrafficOut         int64  `json:"TrafficOut"`
}

type SubRelayRule

type SubRelayRule struct {
	ProxyType                   string   `json:"ProxyType"`
	BindIP                      string   `json:"BindIP"`
	ListenPorts                 []int    `json:"ListenPorts"`
	TargetHost                  string   `json:"TargetHost"`
	TargetPorts                 []int    `json:"TargetPorts"`
	BalanceTargetAddressAddress []string `json:"BalanceTargetAddressAddress"`
}

Jump to

Keyboard shortcuts

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