Chore: add Type() method to proxy.Proxy

This commit is contained in:
xjasonlyu
2021-02-06 18:54:42 +08:00
parent 6375708e4a
commit a84eebe284
5 changed files with 30 additions and 0 deletions

View File

@@ -12,6 +12,8 @@ import (
"github.com/xjasonlyu/tun2socks/component/socks5"
)
var _ Proxy = (*Socks5)(nil)
type Socks5 struct {
*Base
@@ -27,6 +29,10 @@ func NewSocks5(addr, user, pass string) (*Socks5, error) {
}, nil
}
func (ss *Socks5) Type() string {
return "socks5"
}
func (ss *Socks5) DialContext(ctx context.Context, metadata *adapter.Metadata) (c net.Conn, err error) {
c, err = dialer.DialContext(ctx, "tcp", ss.Addr())
if err != nil {