reverseproxyconf

package
v1.10.8 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2023 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var GetValidSSLCertficateList func() []tls.Certificate
View Source
var ReverseProxyServerStore sync.Map
View Source
var ReverseProxyServerStoreMu sync.Mutex
View Source
var SafeCheck func(string, string) bool

Functions

This section is empty.

Types

type ReverseProxy

type ReverseProxy struct {
	SubReverProxyRule
	Enable  bool     `json:"Enable"`
	Remark  string   `json:"Remark"`
	Domains []string `json:"Domains"` //自定义域名

}

type ReverseProxyRule

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 (*ReverseProxyRule) Addr

func (r *ReverseProxyRule) Addr() string

func (*ReverseProxyRule) GetLastLogs

func (r *ReverseProxyRule) GetLastLogs() map[string][]any

func (*ReverseProxyRule) GetServer

func (r *ReverseProxyRule) GetServer() *http.Server

func (*ReverseProxyRule) GetSubRuleByDomain

func (r *ReverseProxyRule) GetSubRuleByDomain(domain string) (*ReverseProxy, bool)

func (*ReverseProxyRule) Init

func (r *ReverseProxyRule) Init()

func (*ReverseProxyRule) ReverseProxyHandler

func (r *ReverseProxyRule) ReverseProxyHandler(c *gin.Context)

func (*ReverseProxyRule) ServerStart

func (r *ReverseProxyRule) ServerStart() error

func (*ReverseProxyRule) ServerStop

func (r *ReverseProxyRule) ServerStop()

func (*ReverseProxyRule) SetServer

func (r *ReverseProxyRule) SetServer(s *http.Server)

type SubReverProxyRule

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 (*SubReverProxyRule) BasicAuthHandler

func (r *SubReverProxyRule) BasicAuthHandler(c *gin.Context) bool

func (*SubReverProxyRule) ClientIP

func (r *SubReverProxyRule) ClientIP(c *gin.Context) string

func (*SubReverProxyRule) Fire

func (r *SubReverProxyRule) Fire(entry *logrus.Entry) error

func (*SubReverProxyRule) GetLocation

func (r *SubReverProxyRule) GetLocation() string

func (*SubReverProxyRule) GetLogger

func (r *SubReverProxyRule) GetLogger() *log.Logger

func (*SubReverProxyRule) GetLogrus

func (r *SubReverProxyRule) GetLogrus() *logrus.Logger

func (*SubReverProxyRule) GetLogsBuffer

func (r *SubReverProxyRule) GetLogsBuffer() *logsbuffer.LogsBuffer

func (*SubReverProxyRule) HandlerReverseProxy

func (r *SubReverProxyRule) HandlerReverseProxy(remote *url.URL, host, path string, c *gin.Context)

func (*SubReverProxyRule) InitTrustedProxyCIDRs

func (r *SubReverProxyRule) InitTrustedProxyCIDRs() error

func (*SubReverProxyRule) Levels

func (r *SubReverProxyRule) Levels() []logrus.Level

func (*SubReverProxyRule) Logf

func (r *SubReverProxyRule) Logf(level logrus.Level, c *gin.Context, format string, v ...any)

Jump to

Keyboard shortcuts

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