add config

This commit is contained in:
ginuerzh
2021-10-29 13:35:44 +08:00
parent 3351aa5974
commit 16ddfba1d1
36 changed files with 1024 additions and 207 deletions

View File

@ -7,6 +7,7 @@ import (
// Transporter is responsible for dialing to the proxy server.
type Dialer interface {
Init(Metadata) error
Dial(ctx context.Context, addr string, opts ...DialOption) (net.Conn, error)
}

View File

@ -6,18 +6,19 @@ import (
"github.com/go-gost/gost/pkg/components/dialer"
"github.com/go-gost/gost/pkg/logger"
"github.com/go-gost/gost/pkg/registry"
)
var (
_ dialer.Dialer = (*Dialer)(nil)
)
func init() {
registry.RegisterDialer("tcp", NewDialer)
}
type Dialer struct {
md metadata
logger logger.Logger
}
func NewDialer(opts ...dialer.Option) *Dialer {
func NewDialer(opts ...dialer.Option) dialer.Dialer {
options := &dialer.Options{}
for _, opt := range opts {
opt(options)