Compare commits

..

No commits in common. "abc73f2ca2b7aeaef172796da382e13c3d69ce8c" and "8e4fc06cf1b7f87db24b04712b990baddfb53082" have entirely different histories.

4 changed files with 9 additions and 77 deletions

View File

@ -8,7 +8,6 @@ import (
"github.com/go-gost/core/bypass"
"github.com/go-gost/core/chain"
"github.com/go-gost/core/limiter/rate"
"github.com/go-gost/core/limiter/traffic"
"github.com/go-gost/core/logger"
"github.com/go-gost/core/metadata"
)
@ -19,7 +18,6 @@ type Options struct {
Auth *url.Userinfo
Auther auth.Authenticator
RateLimiter rate.RateLimiter
Limiter traffic.TrafficLimiter
TLSConfig *tls.Config
Logger logger.Logger
Service string
@ -57,12 +55,6 @@ func RateLimiterOption(limiter rate.RateLimiter) Option {
}
}
func TrafficLimiterOption(limiter traffic.TrafficLimiter) Option {
return func(opts *Options) {
opts.Limiter = limiter
}
}
func TLSConfigOption(tlsConfig *tls.Config) Option {
return func(opts *Options) {
opts.TLSConfig = tlsConfig

View File

@ -2,20 +2,15 @@ package ingress
import "context"
type Options struct{}
type GetOptions struct{}
type Option func(opts *Options)
type GetOption func(opts *GetOptions)
type Rule struct {
// Hostname is the hostname match pattern, e.g. example.com, *.example.org or .example.com.
Hostname string
// Endpoint is the tunnel ID for the hostname.
Endpoint string
}
type SetOptions struct{}
type SetOption func(opts *SetOptions)
type Ingress interface {
// SetRule adds or updates a rule for the ingress.
SetRule(ctx context.Context, rule *Rule, opts ...Option) bool
// GetRule queries a rule by host.
GetRule(ctx context.Context, host string, opts ...Option) *Rule
Get(ctx context.Context, host string, opts ...GetOption) string
Set(ctx context.Context, host, endpoint string, opts ...SetOption)
}

View File

@ -10,40 +10,7 @@ type Limiter interface {
Set(n int)
}
type Options struct {
Network string
Addr string
Client string
Src string
}
type Option func(opts *Options)
func NetworkOption(network string) Option {
return func(opts *Options) {
opts.Network = network
}
}
func AddrOption(addr string) Option {
return func(opts *Options) {
opts.Addr = addr
}
}
func ClientOption(client string) Option {
return func(opts *Options) {
opts.Client = client
}
}
func SrcOption(src string) Option {
return func(opts *Options) {
opts.Src = src
}
}
type TrafficLimiter interface {
In(ctx context.Context, key string, opts ...Option) Limiter
Out(ctx context.Context, key string, opts ...Option) Limiter
In(key string) Limiter
Out(key string) Limiter
}

View File

@ -1,22 +0,0 @@
package router
import (
"context"
"net"
)
type Options struct{}
type Option func(opts *Options)
type Route struct {
// Net is the destination network, e.g. 192.168.0.0/16, 172.10.10.0/24.
Net *net.IPNet
// Gateway is the gateway for the destination network.
Gateway net.IP
}
type Router interface {
// GetRoute queries a route by destination IP address.
GetRoute(ctx context.Context, dst net.IP, opts ...Option) *Route
}