dispatcher

package
v1.1.4 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2023 License: MPL-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var File_config_proto protoreflect.FileDescriptor

Functions

This section is empty.

Types

type Config

type Config struct {
	Settings *SessionConfig `protobuf:"bytes,1,opt,name=settings,proto3" json:"settings,omitempty"`
	// contains filtered or unexported fields
}

func (*Config) Descriptor deprecated

func (*Config) Descriptor() ([]byte, []int)

Deprecated: Use Config.ProtoReflect.Descriptor instead.

func (*Config) GetSettings

func (x *Config) GetSettings() *SessionConfig

func (*Config) ProtoMessage

func (*Config) ProtoMessage()

func (*Config) ProtoReflect

func (x *Config) ProtoReflect() protoreflect.Message

func (*Config) Reset

func (x *Config) Reset()

func (*Config) String

func (x *Config) String() string

type DNSThenOthersSniffResult

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

func (DNSThenOthersSniffResult) Domain

func (f DNSThenOthersSniffResult) Domain() string

func (DNSThenOthersSniffResult) IsProtoSubsetOf

func (f DNSThenOthersSniffResult) IsProtoSubsetOf(protocolName string) bool

func (DNSThenOthersSniffResult) Protocol

func (DNSThenOthersSniffResult) Protocol() string

type DefaultDispatcher

type DefaultDispatcher struct {
	Limiter     *Limiter
	RuleManager *Rule
	// contains filtered or unexported fields
}

DefaultDispatcher is a default implementation of Dispatcher.

func (*DefaultDispatcher) Close

func (*DefaultDispatcher) Close() error

Close implements common.Closable.

func (*DefaultDispatcher) Dispatch

func (d *DefaultDispatcher) Dispatch(ctx context.Context, destination net.Destination) (*transport.Link, error)

Dispatch implements routing.Dispatcher.

func (d *DefaultDispatcher) DispatchLink(ctx context.Context, destination net.Destination, outbound *transport.Link) error

DispatchLink implements routing.Dispatcher.

func (*DefaultDispatcher) Init

func (d *DefaultDispatcher) Init(config *Config, om outbound.Manager, router routing.Router, pm policy.Manager, sm stats.Manager, dns dns.Client) error

Init initializes DefaultDispatcher.

func (*DefaultDispatcher) Start

func (*DefaultDispatcher) Start() error

Start implements common.Runnable.

func (*DefaultDispatcher) Type

func (*DefaultDispatcher) Type() interface{}

Type implements common.HasType.

type InboundInfo added in v0.0.5

type InboundInfo struct {
	Tag             string
	NodeSpeedLimit  int
	NodeDeviceLimit int
	UserLimitInfo   *sync.Map // Key: Uid value: UserLimitInfo
	SpeedLimiter    *sync.Map // key: Uid, value: *ratelimit.Bucket
	UserOnlineIP    *sync.Map // Key: Uid Value: *sync.Map: Key: IP, Value: bool
}

type Limiter added in v0.0.5

type Limiter struct {
	InboundInfo *sync.Map // Key: Tag, Value: *InboundInfo
}

func NewLimiter added in v0.0.5

func NewLimiter() *Limiter

func (*Limiter) AddDynamicSpeedLimit added in v1.1.0

func (l *Limiter) AddDynamicSpeedLimit(tag string, userInfo *panel.UserInfo, limit int, expire int64) error

func (*Limiter) AddInboundLimiter added in v0.0.5

func (l *Limiter) AddInboundLimiter(tag string, nodeInfo *panel.NodeInfo, users []panel.UserInfo) error

func (*Limiter) CheckSpeedAndDeviceLimit added in v0.0.6

func (l *Limiter) CheckSpeedAndDeviceLimit(tag string, email string, ip string) (speedLimiter *ratelimit.Bucket, SpeedLimit bool, Reject bool)

func (*Limiter) ClearOnlineUserIpAndSpeedLimiter added in v0.0.6

func (l *Limiter) ClearOnlineUserIpAndSpeedLimiter(tag string)

func (*Limiter) DeleteInboundLimiter added in v0.0.5

func (l *Limiter) DeleteInboundLimiter(tag string) error

func (*Limiter) ListOnlineUserIp added in v0.0.6

func (l *Limiter) ListOnlineUserIp(tag string) ([]UserIpList, error)

func (*Limiter) RateWriter added in v0.0.5

func (l *Limiter) RateWriter(writer buf.Writer, limiter *ratelimit.Bucket) buf.Writer

func (*Limiter) UpdateInboundLimiter added in v0.0.5

func (l *Limiter) UpdateInboundLimiter(tag string, added []panel.UserInfo, deleted []panel.UserInfo) error

func (*Limiter) UpdateOnlineUserIP added in v0.0.5

func (l *Limiter) UpdateOnlineUserIP(tag string, userIpList []UserIpList)

type Rule added in v0.0.5

type Rule struct {
	Rule *sync.Map // Key: Tag, Value: *panel.DetectRule
}

func NewRule added in v0.0.5

func NewRule() *Rule

func (*Rule) Detect added in v0.0.5

func (r *Rule) Detect(tag string, destination string, protocol string) (reject bool)

func (*Rule) UpdateRule added in v0.0.5

func (r *Rule) UpdateRule(tag string, newRuleList []panel.DestinationRule) error

type SessionConfig

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

func (*SessionConfig) Descriptor deprecated

func (*SessionConfig) Descriptor() ([]byte, []int)

Deprecated: Use SessionConfig.ProtoReflect.Descriptor instead.

func (*SessionConfig) ProtoMessage

func (*SessionConfig) ProtoMessage()

func (*SessionConfig) ProtoReflect

func (x *SessionConfig) ProtoReflect() protoreflect.Message

func (*SessionConfig) Reset

func (x *SessionConfig) Reset()

func (*SessionConfig) String

func (x *SessionConfig) String() string

type SizeStatWriter

type SizeStatWriter struct {
	Counter stats.Counter
	Writer  buf.Writer
}

func (*SizeStatWriter) Close

func (w *SizeStatWriter) Close() error

func (*SizeStatWriter) Interrupt

func (w *SizeStatWriter) Interrupt()

func (*SizeStatWriter) WriteMultiBuffer

func (w *SizeStatWriter) WriteMultiBuffer(mb buf.MultiBuffer) error

type SniffResult

type SniffResult interface {
	Protocol() string
	Domain() string
}

func CompositeResult

func CompositeResult(domainResult SniffResult, protocolResult SniffResult) SniffResult

type Sniffer

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

func NewSniffer

func NewSniffer(ctx context.Context) *Sniffer

func (*Sniffer) Sniff

func (s *Sniffer) Sniff(c context.Context, payload []byte, network net.Network) (SniffResult, error)

func (*Sniffer) SniffMetadata

func (s *Sniffer) SniffMetadata(c context.Context) (SniffResult, error)

type SnifferIsProtoSubsetOf

type SnifferIsProtoSubsetOf interface {
	IsProtoSubsetOf(protocolName string) bool
}

type SnifferResultComposite

type SnifferResultComposite interface {
	ProtocolForDomainResult() string
}

type UserIpList added in v0.0.6

type UserIpList struct {
	Uid    int      `json:"Uid"`
	IpList []string `json:"Ips"`
}

type UserLimitInfo added in v1.0.0

type UserLimitInfo struct {
	UID               int
	SpeedLimit        int
	DynamicSpeedLimit int
	ExpireTime        int64
}

type Writer added in v0.0.5

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

func (*Writer) Close added in v0.0.5

func (w *Writer) Close() error

func (*Writer) WriteMultiBuffer added in v0.0.5

func (w *Writer) WriteMultiBuffer(mb buf.MultiBuffer) error

Jump to

Keyboard shortcuts

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