proxy

package
v0.17.0 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2024 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AVAHI_DNS_CLASS_IN   = uint16(0x01)
	AVAHI_DNS_TYPE_CNAME = uint16(0x05)
)
View Source
const (
	STRIKE = 0
	TEMP   = 1
	PERM   = 2
)

Variables

This section is empty.

Functions

func AddConstellationToken added in v0.16.0

func AddConstellationToken(route utils.ProxyRouteConfig) func(next http.Handler) http.Handler

func BotDetectionMiddleware

func BotDetectionMiddleware(next http.Handler) http.Handler

botDetectionMiddleware checks if the User-Agent is a known bot

func BuildFromConfig

func BuildFromConfig(router *mux.Router, config utils.ProxyConfig) *mux.Router

func CleanUp added in v0.15.0

func CleanUp()

func CleanUpSocket added in v0.17.0

func CleanUpSocket()

func GetActiveProxies added in v0.15.0

func GetActiveProxies() []string

func GetClientID

func GetClientID(r *http.Request, route utils.ProxyRouteConfig) string

func GetShield added in v0.15.0

func GetShield() int

func IPInRange added in v0.17.0

func IPInRange(ip, cidr string) (bool, error)

func InitInternalSocketProxy added in v0.17.0

func InitInternalSocketProxy()

func InitSocketShield added in v0.17.0

func InitSocketShield()

func InitUDPShield added in v0.17.0

func InitUDPShield()

func NewProxy

func NewProxy(targetHost string, AcceptInsecureHTTPSTarget bool, DisableHeaderHardening bool, route utils.ProxyRouteConfig) (*httputil.ReverseProxy, error)

NewProxy takes target host and creates a reverse proxy

func PublishAllMDNSFromConfig added in v0.16.0

func PublishAllMDNSFromConfig()

func RestartMDNS added in v0.16.3

func RestartMDNS()

func RouteTo

func RouteTo(route utils.ProxyRouteConfig) http.Handler

func RouterGen

func RouterGen(route utils.ProxyRouteConfig, router *mux.Router, destination http.Handler) *mux.Route

func SmartShieldMiddleware

func SmartShieldMiddleware(shieldID string, route utils.ProxyRouteConfig) func(http.Handler) http.Handler

func StartBudgetEnforcer added in v0.17.0

func StartBudgetEnforcer()

func StopAllProxies added in v0.17.0

func StopAllProxies()

func TCPSmartShieldMiddleware added in v0.17.0

func TCPSmartShieldMiddleware(shieldID string, route utils.ProxyRouteConfig) func(net.Conn) net.Conn

func UDPSmartShieldMiddleware added in v0.17.0

func UDPSmartShieldMiddleware(shieldID string, route utils.ProxyRouteConfig) func([]byte, net.Addr) []byte

Types

type GlobalSmartShieldState added in v0.17.0

type GlobalSmartShieldState struct {
	sync.Mutex
	// contains filtered or unexported fields
}

type PortsPair added in v0.15.7

type PortsPair struct {
	From string
	To   string
	// contains filtered or unexported fields
}

type ProxyInfo added in v0.17.0

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

type Publisher added in v0.16.0

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

func NewPublisher added in v0.16.0

func NewPublisher() (*Publisher, error)

func (*Publisher) Close added in v0.16.0

func (p *Publisher) Close()

func (*Publisher) Fqdn added in v0.16.0

func (p *Publisher) Fqdn() string

func (*Publisher) UpdateCNAMES added in v0.16.3

func (p *Publisher) UpdateCNAMES(cnames []string, ttl uint32) error

type SmartResponseWriterWrapper

type SmartResponseWriterWrapper struct {
	http.ResponseWriter
	ClientID     string
	Status       int
	Bytes        int64
	ThrottleNext int
	TimeStarted  time.Time
	TimeEnded    time.Time
	RequestCost  int
	Method       string
	// contains filtered or unexported fields
}

func (*SmartResponseWriterWrapper) Flush

func (w *SmartResponseWriterWrapper) Flush()

func (*SmartResponseWriterWrapper) Hijack

func (*SmartResponseWriterWrapper) IsOld

func (w *SmartResponseWriterWrapper) IsOld() bool

func (*SmartResponseWriterWrapper) IsOver

func (w *SmartResponseWriterWrapper) IsOver() bool

func (*SmartResponseWriterWrapper) Write

func (w *SmartResponseWriterWrapper) Write(p []byte) (int, error)

func (*SmartResponseWriterWrapper) WriteHeader

func (w *SmartResponseWriterWrapper) WriteHeader(status int)

type TCPConnectionWrapper added in v0.17.0

type TCPConnectionWrapper struct {
	Conn          net.Conn
	TimeStarted   time.Time
	TimeEnded     time.Time
	ClientID      string
	Packets       int64
	Bytes         int64
	IsOver        bool
	ShieldID      string
	Policy        utils.SmartShieldPolicy
	IsPrivileged  bool
	ThrottleUntil time.Duration

	Route utils.ProxyRouteConfig
	// contains filtered or unexported fields
}

func TCPSmartShieldWrapper added in v0.17.0

func TCPSmartShieldWrapper(conn net.Conn, shieldID string, route utils.ProxyRouteConfig, policy utils.SmartShieldPolicy) *TCPConnectionWrapper

func (*TCPConnectionWrapper) Close added in v0.17.0

func (w *TCPConnectionWrapper) Close() error

func (*TCPConnectionWrapper) LocalAddr added in v0.17.0

func (w *TCPConnectionWrapper) LocalAddr() net.Addr

Implement the missing methods to satisfy the net.Conn interface

func (*TCPConnectionWrapper) Read added in v0.17.0

func (w *TCPConnectionWrapper) Read(b []byte) (int, error)

func (*TCPConnectionWrapper) RemoteAddr added in v0.17.0

func (w *TCPConnectionWrapper) RemoteAddr() net.Addr

func (*TCPConnectionWrapper) SetDeadline added in v0.17.0

func (w *TCPConnectionWrapper) SetDeadline(t time.Time) error

func (*TCPConnectionWrapper) SetReadDeadline added in v0.17.0

func (w *TCPConnectionWrapper) SetReadDeadline(t time.Time) error

func (*TCPConnectionWrapper) SetWriteDeadline added in v0.17.0

func (w *TCPConnectionWrapper) SetWriteDeadline(t time.Time) error

func (*TCPConnectionWrapper) Write added in v0.17.0

func (w *TCPConnectionWrapper) Write(b []byte) (int, error)

type TCPSmartShieldState added in v0.17.0

type TCPSmartShieldState struct {
	sync.Mutex
	Connections []*TCPConnectionWrapper
	Bans        []*UserBan
}

func (*TCPSmartShieldState) EnforceBudget added in v0.17.0

func (shield *TCPSmartShieldState) EnforceBudget()

func (*TCPSmartShieldState) GetServerConnections added in v0.17.0

func (shield *TCPSmartShieldState) GetServerConnections(shieldID string) int

func (*TCPSmartShieldState) GetUserUsedBudgets added in v0.17.0

func (shield *TCPSmartShieldState) GetUserUsedBudgets(shieldID string, clientID string) TCPUserUsedBudget

func (*TCPSmartShieldState) IsAllowedToConnect added in v0.17.0

func (shield *TCPSmartShieldState) IsAllowedToConnect(shieldID string, policy utils.SmartShieldPolicy, userConsumed TCPUserUsedBudget) bool

type TCPUserUsedBudget added in v0.17.0

type TCPUserUsedBudget struct {
	ClientID     string
	Time         float64
	Packets      int64
	Bytes        int64
	Simultaneous int
}

type UDPConnectionInfo added in v0.17.0

type UDPConnectionInfo struct {
	ClientID     string
	ShieldID     string
	BytesSent    int64
	LastActivity time.Time
	RouteName    string
}

type UDPSmartShieldState added in v0.17.0

type UDPSmartShieldState struct {
	sync.Mutex
	Connections map[string]*UDPConnectionInfo
}

type UserBan added in v0.17.0

type UserBan struct {
	ClientID string
	BanType  int
	// contains filtered or unexported fields
}

func GetLastBan added in v0.17.0

func GetLastBan(clientID string, needLock bool) *UserBan

Jump to

Keyboard shortcuts

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