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

@@ -14,6 +14,8 @@ import (
"github.com/Dreamacro/go-shadowsocks2/core"
)
var _ Proxy = (*ShadowSocks)(nil)
type ShadowSocks struct {
*Base
@@ -37,6 +39,10 @@ func NewShadowSocks(addr, method, password, obfsMode, obfsHost string) (*ShadowS
}, nil
}
func (ss *ShadowSocks) Type() string {
return "ss"
}
func (ss *ShadowSocks) DialContext(ctx context.Context, metadata *adapter.Metadata) (c net.Conn, err error) {
c, err = dialer.DialContext(ctx, "tcp", ss.Addr())
if err != nil {