Documentation ¶
Overview ¶
Copyright 2022 gdy, 272288813@qq.com
Copyright 2022 gdy, 272288813@qq.com
Copyright 2022 gdy, 272288813@qq.com
Copyright 2022 gdy, 272288813@qq.com
Index ¶
- Variables
- func BlackListAdd(ip string, activelifeDuration int32) (string, error)
- func BlackListDelete(ip string) error
- func BlackListFlush(lock bool) error
- func BlackListInit()
- func CheckDDNSTaskAvalid(task *DDNSTask) error
- func CheckTCPPortAvalid(port int) bool
- func CreateX509KeyPairByBase64Str(certBase64, keyBase64 string) (*tls.Certificate, error)
- func DDNSTaskListAdd(task *DDNSTask) error
- func DDNSTaskListConfigureCheck()
- func DDNSTaskListDelete(taskKey string) error
- func DDNSTaskSetWebhookCallResult(taskKey string, result bool, message string)
- func EnableDDNSTaskByKey(taskKey string, enable bool) error
- func EnablePortForwardsRuleByKey(key string, enable bool) error
- func EnableReverseProxyRuleByKey(ruleKey string, enable bool) error
- func EnableReverseProxySubRule(ruleKey, proxyKey string, enable bool) error
- func FlushLoginRandomKey()
- func GetAuthAccount() map[string]string
- func GetCertDomainInfo(cert *tls.Certificate) (*[]CertInfo, error)
- func GetCertDomains(cert *tls.Certificate) []string
- func GetConfigureBytes() []byte
- func GetDomainsStrByDomains(dst []string) string
- func GetDomainsTrimSpace(dst []string) []string
- func GetLoginRandomKey() string
- func GetPortForwardsGlobalProxyCount() int
- func GetPortForwardsGlobalProxyCountExcept(key string) int
- func GetRunMode() string
- func GetValidSSLCertficateList() []tls.Certificate
- func GetVersion() string
- func InitAppInfo(version, date string)
- func LoadDefault(adminWebListenPort int)
- func PortForwardsRuleListAdd(r *PortForwardsRule) error
- func PortForwardsRuleListDelete(key string) error
- func PortForwardsRuleListInit()
- func PortsCheck(ports1Str, ports2Str string) (bool, error)
- func PortsStrToIList(portsStr string) (ports []int, err error)
- func Read(filePath string) (err error)
- func ReverseProxyRuleListAdd(rule *ReverseProxyRule) error
- func ReverseProxyRuleListDelete(ruleKey string) error
- func SSLCertficateAlterRemark(key, remark string) error
- func SSLCertficateEnable(key string, enable bool) error
- func SSLCertficateListAdd(s *SSLCertficate) error
- func SSLCertficateListDelete(key string) error
- func SSLCertficateListInit()
- func SafeCheck(mode, ip string) bool
- func Save() (err error)
- func SetBaseConfigure(conf *BaseConfigure) error
- func SetConfig(p *ProgramConfigure) error
- func SetDDNSConfigure(conf *DDNSConfigure) error
- func SetPortForwardsConfigure(conf *PortForwardsConfigure) error
- func SetRunMode(mode string)
- func SetVersion(v string)
- func SetWhiteListBaseConfigure(activelifeDuration int32, url, account, password string) error
- func StartAllSocketProxysByRuleKey(key string) error
- func StopAllSocketProxysByRuleKey(key string) error
- func TidyPortforwardLogsCache()
- func TidyReverseProxyCache()
- func UpdatePortForwardsRuleToPortForwardsRuleList(key string, r *PortForwardsRule) error
- func UpdateReverseProxyRulet(rule ReverseProxyRule) error
- func UpdateTaskToDDNSTaskList(taskKey string, task DDNSTask) error
- func WOLDeviceListAdd(d *WOLDevice) error
- func WOLDeviceListAlter(d *WOLDevice) error
- func WOLDeviceListDelete(key string) error
- func WakeOnLan(macList []string, broadcastIps []string, port, repeat int) (err error)
- func WebLogConvert(lg *logsbuffer.LogItem) any
- func WhiteListAdd(ip string, activelifeDuration int32) (string, error)
- func WhiteListDelete(ip string) error
- func WhiteListFlush(lock bool) error
- func WhiteListInit()
- type AppInfo
- type BaseConfigure
- type BlackListConfigure
- type BlackListItem
- type CertInfo
- type DDNSConfigure
- type DDNSTask
- type DNSCallback
- type DNSConfig
- type LogItem
- type PortForwardsConfigure
- type PortForwardsRule
- func (r *PortForwardsRule) Fire(entry *logrus.Entry) error
- func (r *PortForwardsRule) GetLastLogs(maxCount int) []any
- func (r *PortForwardsRule) GetLogrus() *logrus.Logger
- func (r *PortForwardsRule) GetLogsBuffer() *logsbuffer.LogsBuffer
- func (r *PortForwardsRule) InitProxyList() error
- func (r *PortForwardsRule) Levels() []logrus.Level
- func (r *PortForwardsRule) ProxyCount() int
- func (r *PortForwardsRule) StartAllProxys()
- func (r *PortForwardsRule) StopAllProxys()
- type ProgramConfigure
- type ReverseProxy
- type ReverseProxyRule
- func (r *ReverseProxyRule) Addr() string
- func (r *ReverseProxyRule) GetLastLogs() map[string][]any
- func (r *ReverseProxyRule) GetServer() *http.Server
- func (r *ReverseProxyRule) GetSubRuleByDomain(domain string) (*ReverseProxy, bool)
- func (r *ReverseProxyRule) Init()
- func (r *ReverseProxyRule) ReverseProxyHandler(c *gin.Context)
- func (r *ReverseProxyRule) ServerStart() error
- func (r *ReverseProxyRule) ServerStop()
- func (r *ReverseProxyRule) SetServer(s *http.Server)
- type SSLCertficate
- type SubReverProxyRule
- func (r *SubReverProxyRule) BasicAuthHandler(c *gin.Context) bool
- func (r *SubReverProxyRule) ClientIP(c *gin.Context) string
- func (r *SubReverProxyRule) Fire(entry *logrus.Entry) error
- func (r *SubReverProxyRule) GetLocation() string
- func (r *SubReverProxyRule) GetLogger() *log.Logger
- func (r *SubReverProxyRule) GetLogrus() *logrus.Logger
- func (r *SubReverProxyRule) GetLogsBuffer() *logsbuffer.LogsBuffer
- func (r *SubReverProxyRule) HandlerReverseProxy(remote *url.URL, host, path string, c *gin.Context)
- func (r *SubReverProxyRule) InitTrustedProxyCIDRs() error
- func (r *SubReverProxyRule) Levels() []logrus.Level
- func (r *SubReverProxyRule) Logf(level logrus.Level, c *gin.Context, format string, v ...any)
- type WOLDevice
- type Webhook
- type WhiteListBaseConfigure
- type WhiteListConfigure
- type WhiteListItem
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultIPv4DNSServerList = []string{
"1.1.1.1:53",
"1.2.4.8:53",
"8.8.8.8:53",
"9.9.9.9:53",
"8.8.4.4:53",
"114.114.114.114:53",
"223.5.5.5:53",
"223.6.6.6:53",
"101.226.4.6:53",
"218.30.118.6:53",
"119.28.28.28:53",
}
View Source
var DefaultIPv6DNSServerList = []string{
"[2001:4860:4860::8888]:53",
"[2001:4860:4860::8844]:53",
"[2606:4700:4700::64]:53",
"[2606:4700:4700::6400]:53",
"[240C::6666]:53",
"[240C::6644]:53",
"[2402:4e00::]:53",
"[240e:4c:4008::1]:53",
"[240e:4c:4808::1]:53",
"[2408:8899::8]:53",
"[2408:8888::8]:53",
"[2409:8088::a]:53",
"[2409:8088::b]:53",
"[2001:dc7:1000::1]:53",
"[2400:da00::6666]:53",
}
Functions ¶
func BlackListDelete ¶
func BlackListFlush ¶
func BlackListInit ¶ added in v1.3.1
func BlackListInit()
func CheckDDNSTaskAvalid ¶
func CheckTCPPortAvalid ¶
func CreateX509KeyPairByBase64Str ¶ added in v1.5.1
func CreateX509KeyPairByBase64Str(certBase64, keyBase64 string) (*tls.Certificate, error)
func DDNSTaskListAdd ¶
func DDNSTaskListConfigureCheck ¶ added in v1.2.1
func DDNSTaskListConfigureCheck()
func DDNSTaskListDelete ¶
func EnableDDNSTaskByKey ¶
func EnablePortForwardsRuleByKey ¶ added in v1.5.1
func EnableReverseProxyRuleByKey ¶ added in v1.3.1
func EnableReverseProxySubRule ¶ added in v1.3.1
func FlushLoginRandomKey ¶
func FlushLoginRandomKey()
func GetAuthAccount ¶
func GetCertDomainInfo ¶ added in v1.5.1
func GetCertDomainInfo(cert *tls.Certificate) (*[]CertInfo, error)
func GetCertDomains ¶ added in v1.5.1
func GetCertDomains(cert *tls.Certificate) []string
func GetConfigureBytes ¶ added in v1.1.8
func GetConfigureBytes() []byte
func GetDomainsStrByDomains ¶ added in v1.5.1
func GetLoginRandomKey ¶
func GetLoginRandomKey() string
func GetPortForwardsGlobalProxyCount ¶ added in v1.5.1
func GetPortForwardsGlobalProxyCount() int
func GetPortForwardsGlobalProxyCountExcept ¶ added in v1.5.1
func GetRunMode ¶
func GetRunMode() string
func GetValidSSLCertficateList ¶ added in v1.5.1
func GetValidSSLCertficateList() []tls.Certificate
func GetVersion ¶
func GetVersion() string
func InitAppInfo ¶
func InitAppInfo(version, date string)
func LoadDefault ¶
func LoadDefault(adminWebListenPort int)
func PortForwardsRuleListAdd ¶ added in v1.5.1
func PortForwardsRuleListAdd(r *PortForwardsRule) error
func PortForwardsRuleListDelete ¶ added in v1.5.1
func PortForwardsRuleListInit ¶ added in v1.5.1
func PortForwardsRuleListInit()
func PortsCheck ¶ added in v1.5.1
func PortsStrToIList ¶ added in v1.5.1
portsStrToIList
func ReverseProxyRuleListAdd ¶ added in v1.3.1
func ReverseProxyRuleListAdd(rule *ReverseProxyRule) error
func ReverseProxyRuleListDelete ¶ added in v1.3.1
func SSLCertficateAlterRemark ¶ added in v1.5.1
func SSLCertficateEnable ¶ added in v1.5.1
func SSLCertficateListAdd ¶ added in v1.5.1
func SSLCertficateListAdd(s *SSLCertficate) error
func SSLCertficateListDelete ¶ added in v1.5.1
func SSLCertficateListInit ¶ added in v1.5.1
func SSLCertficateListInit()
func SetConfig ¶ added in v1.1.8
func SetConfig(p *ProgramConfigure) error
func SetDDNSConfigure ¶
func SetDDNSConfigure(conf *DDNSConfigure) error
func SetPortForwardsConfigure ¶ added in v1.5.1
func SetPortForwardsConfigure(conf *PortForwardsConfigure) error
func SetRunMode ¶
func SetRunMode(mode string)
func SetVersion ¶
func SetVersion(v string)
func StartAllSocketProxysByRuleKey ¶ added in v1.5.1
func StopAllSocketProxysByRuleKey ¶ added in v1.5.1
func TidyPortforwardLogsCache ¶ added in v1.5.1
func TidyPortforwardLogsCache()
TidyReverseProxyCache 整理端口转发日志缓存
func TidyReverseProxyCache ¶ added in v1.3.1
func TidyReverseProxyCache()
TidyReverseProxyCache 整理反向代理日志缓存
func UpdatePortForwardsRuleToPortForwardsRuleList ¶ added in v1.5.1
func UpdatePortForwardsRuleToPortForwardsRuleList(key string, r *PortForwardsRule) error
func UpdateReverseProxyRulet ¶ added in v1.3.1
func UpdateReverseProxyRulet(rule ReverseProxyRule) error
func WOLDeviceListAdd ¶ added in v1.5.1
func WOLDeviceListAlter ¶ added in v1.5.1
func WOLDeviceListDelete ¶ added in v1.5.1
func WebLogConvert ¶ added in v1.5.1
func WebLogConvert(lg *logsbuffer.LogItem) any
2006-01-02 15:04:05
func WhiteListDelete ¶
func WhiteListFlush ¶
func WhiteListInit ¶ added in v1.3.1
func WhiteListInit()
Types ¶
type AppInfo ¶
type AppInfo struct { AppName string Version string OS string ARCH string Date string RunTime string GoVersion string }
func GetAppInfo ¶
func GetAppInfo() *AppInfo
type BaseConfigure ¶
type BaseConfigure struct { AdminWebListenPort int `json:"AdminWebListenPort"` //管理后台端口 AdminWebListenTLS bool `json:"AdminWebListenTLS"` //启用TLS监听端口 AdminWebListenHttpsPort int `json:"AdminWebListenHttpsPort"` //管理后台Https端口 //ProxyCountLimit int64 `json:"ProxyCountLimit"` //全局代理数量限制 AdminAccount string `json:"AdminAccount"` //登录账号 AdminPassword string `json:"AdminPassword"` //登录密码 AllowInternetaccess bool `json:"AllowInternetaccess"` //允许外网访问 //GlobalMaxConnections int64 `json:"GlobalMaxConnections"` //全局最大连接数 LogMaxSize int `json:"LogMaxSize"` //日志记录最大条数 }
func GetBaseConfigure ¶
func GetBaseConfigure() BaseConfigure
type BlackListConfigure ¶
type BlackListConfigure struct {
BlackList []BlackListItem `json:"BlackList"` //黑名单列表
}
type BlackListItem ¶
type BlackListItem WhiteListItem
func DeleteBlackListlice ¶
func DeleteBlackListlice(a []BlackListItem, deleteIndex int) []BlackListItem
func GetBlackList ¶
func GetBlackList() []BlackListItem
func (*BlackListItem) Contains ¶ added in v1.3.1
func (w *BlackListItem) Contains(ip string) bool
type DDNSConfigure ¶
type DDNSConfigure struct { Enable bool `json:"Enable"` HttpClientSecureVerify bool `json:"HttpClientSecureVerify"` FirstCheckDelay int `json:"FirstCheckDelay"` //首次检查延迟时间 Intervals int `json:"Intervals"` }
func GetDDNSConfigure ¶
func GetDDNSConfigure() DDNSConfigure
type DDNSTask ¶
type DDNSTask struct { TaskName string `json:"TaskName"` TaskKey string `json:"TaskKey"` //添加任务时随机生成,方便管理任务(修改删除) //规则类型 IPv4/IPv6 TaskType string `json:"TaskType"` Enable bool GetType string `json:"GetType"` URL []string `json:"URL"` NetInterface string `json:"NetInterface"` IPReg string `json:"IPReg"` Domains []string `json:"Domains"` DNS DNSConfig `json:"DNS"` Webhook TTL string `json:"TTL"` HttpClientTimeout int `json:"HttpClientTimeout"` }
func DeleteDDNSTaskListlice ¶
func GetDDNSTaskByKey ¶
func GetDDNSTaskConfigureList ¶ added in v1.2.1
func GetDDNSTaskConfigureList() []*DDNSTask
type DNSCallback ¶
type DNSCallback struct { URL string `json:"URL"` //请求地址 Method string `json:"Method"` //请求方法 Headers []string `json:"Headers"` RequestBody string `json:"RequestBody"` Server string `json:"Server"` //预设服务商 DisableCallbackSuccessContentCheck bool `json:"DisableCallbackSuccessContentCheck"` //禁用成功调用返回检测 CallbackSuccessContent []string `json:"CallbackSuccessContent"` //接口调用成功包含内容 }
type DNSConfig ¶
type DNSConfig struct { // 名称。如:alidns,webhook Name string `json:"Name"` ID string `json:"ID"` Secret string `json:"Secret"` ForceInterval int `json:"ForceInterval"` //(秒)即使IP没有变化,到一定时间后依然强制更新或先DNS解析比较IP再更新 ResolverDoaminCheck bool `json:"ResolverDoaminCheck"` //调用callback同步前先解析一次域名,如果IP相同就不同步 DNSServerList []string `json:"DNSServerList"` //DNS服务器列表 CallAPINetwork string `json:"CallAPINetwork"` //空代理tcp, tcp4,tcp6 Callback DNSCallback `json:"Callback"` HttpClientProxyType string `json:"HttpClientProxyType"` //http client代理服务器设置 HttpClientProxyAddr string `json:"HttpClientProxyAddr"` //代理服务器IP HttpClientProxyUser string `json:"HttpClientProxyUser"` //代理用户 HttpClientProxyPassword string `json:"HttpClientProxyPassword"` //代理密码 }
DNSConfig DNS配置
func (*DNSConfig) GetCallAPINetwork ¶ added in v1.5.1
type PortForwardsConfigure ¶ added in v1.5.1
type PortForwardsConfigure struct { PortForwardsLimit int64 `json:"PortForwardsLimit"` //全局端口转发数量限制 TCPPortforwardMaxConnections int64 `json:"TCPPortforwardMaxConnections"` //端口转发全局TCP并发链接数限制 UDPReadTargetDataMaxgoroutineCount int64 `json:"UDPReadTargetDataMaxgoroutineCount"` //端口转发全局UDP读取目标地址数据协程数限制 }
func GetPortForwardsConfigure ¶ added in v1.5.1
func GetPortForwardsConfigure() PortForwardsConfigure
type PortForwardsRule ¶ added in v1.5.1
type PortForwardsRule struct { Name string `json:"Name"` Key string `json:"Key"` Enable bool `json:"Enable"` ForwardTypes []string `json:"ForwardTypes"` ListenAddress string `json:"ListenAddress"` ListenPorts string `json:"ListenPorts"` TargetAddressList []string `json:"TargetAddressList"` TargetPorts string `json:"TargetPorts"` Options socketproxy.RelayRuleOptions `json:"Options"` ReverseProxyList *[]socketproxy.Proxy `json:"-"` LogLevel int `json:"LogLevel"` //日志输出级别 LogOutputToConsole bool `json:"LogOutputToConsole"` //日志输出到终端 AccessLogMaxNum int `json:"AccessLogMaxNum"` WebListShowLastLogMaxCount int `json:"WebListShowLastLogMaxCount"` //前端列表显示最新日志最大条数 // contains filtered or unexported fields }
func DeletePortForwardsRuleListSlice ¶ added in v1.5.1
func DeletePortForwardsRuleListSlice(a []PortForwardsRule, deleteIndex int) []PortForwardsRule
func GetPortForwardsRuleByKey ¶ added in v1.5.1
func GetPortForwardsRuleByKey(key string) *PortForwardsRule
func GetPortForwardsRuleList ¶ added in v1.5.1
func GetPortForwardsRuleList() []PortForwardsRule
func (*PortForwardsRule) Fire ¶ added in v1.5.1
func (r *PortForwardsRule) Fire(entry *logrus.Entry) error
func (*PortForwardsRule) GetLastLogs ¶ added in v1.5.1
func (r *PortForwardsRule) GetLastLogs(maxCount int) []any
func (*PortForwardsRule) GetLogrus ¶ added in v1.5.1
func (r *PortForwardsRule) GetLogrus() *logrus.Logger
func (*PortForwardsRule) GetLogsBuffer ¶ added in v1.5.1
func (r *PortForwardsRule) GetLogsBuffer() *logsbuffer.LogsBuffer
func (*PortForwardsRule) InitProxyList ¶ added in v1.5.1
func (r *PortForwardsRule) InitProxyList() error
func (*PortForwardsRule) Levels ¶ added in v1.5.1
func (r *PortForwardsRule) Levels() []logrus.Level
func (*PortForwardsRule) ProxyCount ¶ added in v1.5.1
func (r *PortForwardsRule) ProxyCount() int
func (*PortForwardsRule) StartAllProxys ¶ added in v1.5.1
func (r *PortForwardsRule) StartAllProxys()
func (*PortForwardsRule) StopAllProxys ¶ added in v1.5.1
func (r *PortForwardsRule) StopAllProxys()
type ProgramConfigure ¶
type ProgramConfigure struct { BaseConfigure BaseConfigure `json:"BaseConfigure"` WhiteListConfigure WhiteListConfigure `json:"WhiteListConfigure"` BlackListConfigure BlackListConfigure `json:"BlackListConfigure"` DDNSConfigure DDNSConfigure `json:"DDNSConfigure"` //DDNS 参数设置 DDNSTaskList []DDNSTask `json:"DDNSTaskList"` //DDNS任务列表 ReverseProxyRuleList []ReverseProxyRule `json:"ReverseProxyRuleList"` //反向代理规则列表 SSLCertficateList []SSLCertficate `json:"SSLCertficateList"` //SSL证书列表 PortForwardsRuleList []PortForwardsRule `json:"PortForwardsRuleList"` //端口转发规则列表 PortForwardsConfigure PortForwardsConfigure `json:"PortForwardsConfigure"` //端口转发设置 WOLDeviceList []WOLDevice `json:"WOLDeviceList"` //网络唤醒设备列表 }
func GetConfig ¶
func GetConfig() *ProgramConfigure
type ReverseProxy ¶ added in v1.3.1
type ReverseProxy struct { SubReverProxyRule Enable bool `json:"Enable"` Remark string `json:"Remark"` Domains []string `json:"Domains"` //自定义域名 }
type ReverseProxyRule ¶ added in v1.3.1
type ReverseProxyRule struct { RuleName string `json:"RuleName"` RuleKey string `json:"RuleKey"` Enable bool `json:"Enable"` ListenIP string `json:"ListenIP"` ListenPort int `json:"ListenPort"` EnableTLS bool `json:"EnableTLS"` Network string `json:"Network"` DefaultProxy struct { SubReverProxyRule } `json:"DefaultProxy"` ProxyList []ReverseProxy `json:"ProxyList"` // contains filtered or unexported fields }
func DeleteReverseProxyRuleListlice ¶ added in v1.3.1
func DeleteReverseProxyRuleListlice(a []ReverseProxyRule, deleteIndex int) []ReverseProxyRule
func GetReverseProxyRuleByKey ¶ added in v1.3.1
func GetReverseProxyRuleByKey(ruleKey string) *ReverseProxyRule
func GetReverseProxyRuleList ¶ added in v1.3.1
func GetReverseProxyRuleList() []*ReverseProxyRule
func (*ReverseProxyRule) Addr ¶ added in v1.3.1
func (r *ReverseProxyRule) Addr() string
func (*ReverseProxyRule) GetLastLogs ¶ added in v1.3.1
func (r *ReverseProxyRule) GetLastLogs() map[string][]any
func (*ReverseProxyRule) GetServer ¶ added in v1.3.1
func (r *ReverseProxyRule) GetServer() *http.Server
func (*ReverseProxyRule) GetSubRuleByDomain ¶ added in v1.3.1
func (r *ReverseProxyRule) GetSubRuleByDomain(domain string) (*ReverseProxy, bool)
func (*ReverseProxyRule) Init ¶ added in v1.3.1
func (r *ReverseProxyRule) Init()
func (*ReverseProxyRule) ReverseProxyHandler ¶ added in v1.3.1
func (r *ReverseProxyRule) ReverseProxyHandler(c *gin.Context)
func (*ReverseProxyRule) ServerStart ¶ added in v1.3.1
func (r *ReverseProxyRule) ServerStart() error
func (*ReverseProxyRule) ServerStop ¶ added in v1.3.1
func (r *ReverseProxyRule) ServerStop()
func (*ReverseProxyRule) SetServer ¶ added in v1.3.1
func (r *ReverseProxyRule) SetServer(s *http.Server)
type SSLCertficate ¶ added in v1.5.1
type SSLCertficate struct { Key string `json:"Key"` Enable bool `json:"Enable"` Remark string `json:"Remark"` //备注 CertBase64 string `json:"CertBase64"` KeyBase64 string `json:"KeyBase64"` AddTime string `json:"AddTime"` //添加时间 CertsInfo *[]CertInfo `json:"-"` //--------------------- Certificate *tls.Certificate `json:"-"` }
func DeleteSSLCertficateListslice ¶ added in v1.5.1
func DeleteSSLCertficateListslice(a []SSLCertficate, deleteIndex int) []SSLCertficate
func GetSSLCertficateList ¶ added in v1.5.1
func GetSSLCertficateList() []SSLCertficate
func (*SSLCertficate) GetFirstDomain ¶ added in v1.5.1
func (s *SSLCertficate) GetFirstDomain() string
GetOnlyDomain 返回证书第一条域名
func (*SSLCertficate) Init ¶ added in v1.5.1
func (s *SSLCertficate) Init() error
type SubReverProxyRule ¶ added in v1.3.1
type SubReverProxyRule struct { Key string `json:"Key"` Locations []string `json:"Locations"` //长度大于1时均衡负载 EnableAccessLog bool `json:"EnableAccessLog"` //开启日志 LogLevel int `json:"LogLevel"` //日志输出级别 LogOutputToConsole bool `json:"LogOutputToConsole"` //日志输出到终端 AccessLogMaxNum int `json:"AccessLogMaxNum"` //最大条数 WebListShowLastLogMaxCount int `json:"WebListShowLastLogMaxCount"` //前端列表显示最新日志最大条数 ForwardedByClientIP bool `json:"ForwardedByClientIP"` TrustedCIDRsStrList []string `json:"TrustedCIDRsStrList"` RemoteIPHeaders []string `json:"RemoteIPHeaders"` //识别客户端原始IP的Http请求头 TrustedProxyCIDRs []*net.IPNet `json:"-"` AddRemoteIPToHeader bool `json:"AddRemoteIPToHeader"` //追加客户端连接IP到指定Header AddRemoteIPHeaderKey string `json:"AddRemoteIPHeaderKey"` EnableBasicAuth bool `json:"EnableBasicAuth"` //启用BasicAuth认证 BasicAuthUser string `json:"BasicAuthUser"` //如果配置此参数,暴露出去的 HTTP 服务需要采用 Basic Auth 的鉴权才能访问 BasicAuthPasswd string `json:"BasicAuthPasswd"` //结合 BasicAuthUser 使用 SafeIPMode string `json:"SafeIPMode"` //IP过滤模式 黑白名单 SafeUserAgentMode string `json:"SafeUserAgentMode"` //UserAgent 过滤模式 黑白名单 UserAgentfilter []string `json:"UserAgentfilter"` //UserAgent 过滤内容 CustomRobotTxt bool `json:"CustomRobotTxt"` RobotTxt string `json:"RobotTxt"` // contains filtered or unexported fields }
func GetSubRuleByKey ¶ added in v1.3.1
func GetSubRuleByKey(ruleKey, proxyKey string) *SubReverProxyRule
func (*SubReverProxyRule) BasicAuthHandler ¶ added in v1.3.1
func (r *SubReverProxyRule) BasicAuthHandler(c *gin.Context) bool
func (*SubReverProxyRule) ClientIP ¶ added in v1.3.1
func (r *SubReverProxyRule) ClientIP(c *gin.Context) string
func (*SubReverProxyRule) Fire ¶ added in v1.5.1
func (r *SubReverProxyRule) Fire(entry *logrus.Entry) error
func (*SubReverProxyRule) GetLocation ¶ added in v1.3.1
func (r *SubReverProxyRule) GetLocation() string
func (*SubReverProxyRule) GetLogger ¶ added in v1.3.1
func (r *SubReverProxyRule) GetLogger() *log.Logger
func (*SubReverProxyRule) GetLogrus ¶ added in v1.3.1
func (r *SubReverProxyRule) GetLogrus() *logrus.Logger
func (*SubReverProxyRule) GetLogsBuffer ¶ added in v1.3.1
func (r *SubReverProxyRule) GetLogsBuffer() *logsbuffer.LogsBuffer
func (*SubReverProxyRule) HandlerReverseProxy ¶ added in v1.3.1
func (*SubReverProxyRule) InitTrustedProxyCIDRs ¶ added in v1.3.1
func (r *SubReverProxyRule) InitTrustedProxyCIDRs() error
func (*SubReverProxyRule) Levels ¶ added in v1.5.1
func (r *SubReverProxyRule) Levels() []logrus.Level
type WOLDevice ¶ added in v1.5.1
type WOLDevice struct { Key string DeviceName string MacList []string BroadcastIPs []string Port int Relay bool //交给中继设备发送 Repeat int //重复发送次数 }
func DeleteWOLDeviceListslice ¶ added in v1.5.1
func GetWOLDeviceByKey ¶ added in v1.5.1
func GetWOLDeviceList ¶ added in v1.5.1
func GetWOLDeviceList() []WOLDevice
type Webhook ¶
type Webhook struct { WebhookEnable bool `json:"WebhookEnable"` //Webhook开关 WebhookCallOnGetIPfail bool `json:"WebhookCallOnGetIPfail"` //获取IP失败时触发Webhook 开关 WebhookURL string `json:"WebhookURL"` WebhookMethod string `json:"WebhookMethod"` WebhookHeaders []string `json:"WebhookHeaders"` WebhookRequestBody string `json:"WebhookRequestBody"` WebhookDisableCallbackSuccessContentCheck bool `json:"WebhookDisableCallbackSuccessContentCheck"` //禁用成功调用返回检测 WebhookSuccessContent []string `json:"WebhookSuccessContent"` //接口调用成功包含的内容 WebhookProxy string `json:"WebhookProxy"` //使用DNS代理设置 ""表示禁用,"dns"表示使用dns的代理设置 WebhookProxyAddr string `json:"WebhookProxyAddr"` //代理服务器IP WebhookProxyUser string `json:"WebhookProxyUser"` //代理用户 WebhookProxyPassword string `json:"WebhookProxyPassword"` //代理密码 }
type WhiteListBaseConfigure ¶
type WhiteListBaseConfigure struct { URL string `json:"URL"` ActivelifeDuration int32 `json:"ActivelifeDuration"` //有效期限,小时 BasicAccount string `json:"BasicAccount"` BasicPassword string `json:"BasicPassword"` }
func GetWhiteListBaseConfigure ¶
func GetWhiteListBaseConfigure() WhiteListBaseConfigure
type WhiteListConfigure ¶
type WhiteListConfigure struct { BaseConfigure WhiteListBaseConfigure `json:"BaseConfigure"` WhiteList []WhiteListItem `json:"WhiteList"` //白名单列表 }
type WhiteListItem ¶
type WhiteListItem struct { IP string `json:"IP"` EffectiveTime string `json:"Effectivetime"` //有效时间 NetIP net.IP `json:"-"` Cidr *net.IPNet `json:"-"` }
func DeleteWhiteListlice ¶
func DeleteWhiteListlice(a []WhiteListItem, deleteIndex int) []WhiteListItem
func GetWhiteList ¶
func GetWhiteList() []WhiteListItem
func (*WhiteListItem) Contains ¶ added in v1.3.1
func (w *WhiteListItem) Contains(ip string) bool
Click to show internal directories.
Click to hide internal directories.