Compare commits
No commits in common. "abc73f2ca2b7aeaef172796da382e13c3d69ce8c" and "8e4fc06cf1b7f87db24b04712b990baddfb53082" have entirely different histories.
abc73f2ca2
...
8e4fc06cf1
@ -8,7 +8,6 @@ import (
|
|||||||
"github.com/go-gost/core/bypass"
|
"github.com/go-gost/core/bypass"
|
||||||
"github.com/go-gost/core/chain"
|
"github.com/go-gost/core/chain"
|
||||||
"github.com/go-gost/core/limiter/rate"
|
"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/logger"
|
||||||
"github.com/go-gost/core/metadata"
|
"github.com/go-gost/core/metadata"
|
||||||
)
|
)
|
||||||
@ -19,7 +18,6 @@ type Options struct {
|
|||||||
Auth *url.Userinfo
|
Auth *url.Userinfo
|
||||||
Auther auth.Authenticator
|
Auther auth.Authenticator
|
||||||
RateLimiter rate.RateLimiter
|
RateLimiter rate.RateLimiter
|
||||||
Limiter traffic.TrafficLimiter
|
|
||||||
TLSConfig *tls.Config
|
TLSConfig *tls.Config
|
||||||
Logger logger.Logger
|
Logger logger.Logger
|
||||||
Service string
|
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 {
|
func TLSConfigOption(tlsConfig *tls.Config) Option {
|
||||||
return func(opts *Options) {
|
return func(opts *Options) {
|
||||||
opts.TLSConfig = tlsConfig
|
opts.TLSConfig = tlsConfig
|
||||||
|
@ -2,20 +2,15 @@ package ingress
|
|||||||
|
|
||||||
import "context"
|
import "context"
|
||||||
|
|
||||||
type Options struct{}
|
type GetOptions struct{}
|
||||||
|
|
||||||
type Option func(opts *Options)
|
type GetOption func(opts *GetOptions)
|
||||||
|
|
||||||
type Rule struct {
|
type SetOptions struct{}
|
||||||
// Hostname is the hostname match pattern, e.g. example.com, *.example.org or .example.com.
|
|
||||||
Hostname string
|
type SetOption func(opts *SetOptions)
|
||||||
// Endpoint is the tunnel ID for the hostname.
|
|
||||||
Endpoint string
|
|
||||||
}
|
|
||||||
|
|
||||||
type Ingress interface {
|
type Ingress interface {
|
||||||
// SetRule adds or updates a rule for the ingress.
|
Get(ctx context.Context, host string, opts ...GetOption) string
|
||||||
SetRule(ctx context.Context, rule *Rule, opts ...Option) bool
|
Set(ctx context.Context, host, endpoint string, opts ...SetOption)
|
||||||
// GetRule queries a rule by host.
|
|
||||||
GetRule(ctx context.Context, host string, opts ...Option) *Rule
|
|
||||||
}
|
}
|
||||||
|
@ -10,40 +10,7 @@ type Limiter interface {
|
|||||||
Set(n int)
|
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 {
|
type TrafficLimiter interface {
|
||||||
In(ctx context.Context, key string, opts ...Option) Limiter
|
In(key string) Limiter
|
||||||
Out(ctx context.Context, key string, opts ...Option) Limiter
|
Out(key string) Limiter
|
||||||
}
|
}
|
||||||
|
@ -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
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user