support multiple network interfaces
This commit is contained in:
@ -7,17 +7,12 @@ import (
|
||||
"github.com/go-gost/gost/pkg/auth"
|
||||
"github.com/go-gost/gost/pkg/bypass"
|
||||
"github.com/go-gost/gost/pkg/chain"
|
||||
"github.com/go-gost/gost/pkg/hosts"
|
||||
"github.com/go-gost/gost/pkg/logger"
|
||||
"github.com/go-gost/gost/pkg/resolver"
|
||||
)
|
||||
|
||||
type Options struct {
|
||||
Retries int
|
||||
Chain chain.Chainer
|
||||
Resolver resolver.Resolver
|
||||
Hosts hosts.HostMapper
|
||||
Bypass bypass.Bypass
|
||||
Router *chain.Router
|
||||
Auth *url.Userinfo
|
||||
Auther auth.Authenticator
|
||||
TLSConfig *tls.Config
|
||||
@ -26,41 +21,24 @@ type Options struct {
|
||||
|
||||
type Option func(opts *Options)
|
||||
|
||||
func RetriesOption(retries int) Option {
|
||||
return func(opts *Options) {
|
||||
opts.Retries = retries
|
||||
}
|
||||
}
|
||||
|
||||
func ChainOption(chain chain.Chainer) Option {
|
||||
return func(opts *Options) {
|
||||
opts.Chain = chain
|
||||
}
|
||||
}
|
||||
|
||||
func ResolverOption(resolver resolver.Resolver) Option {
|
||||
return func(opts *Options) {
|
||||
opts.Resolver = resolver
|
||||
}
|
||||
}
|
||||
|
||||
func HostsOption(hosts hosts.HostMapper) Option {
|
||||
return func(opts *Options) {
|
||||
opts.Hosts = hosts
|
||||
}
|
||||
}
|
||||
|
||||
func BypassOption(bypass bypass.Bypass) Option {
|
||||
return func(opts *Options) {
|
||||
opts.Bypass = bypass
|
||||
}
|
||||
}
|
||||
|
||||
func RouterOption(router *chain.Router) Option {
|
||||
return func(opts *Options) {
|
||||
opts.Router = router
|
||||
}
|
||||
}
|
||||
|
||||
func AuthOption(auth *url.Userinfo) Option {
|
||||
return func(opts *Options) {
|
||||
opts.Auth = auth
|
||||
}
|
||||
}
|
||||
|
||||
func AutherOption(auther auth.Authenticator) Option {
|
||||
return func(opts *Options) {
|
||||
opts.Auther = auther
|
||||
|
Reference in New Issue
Block a user