Break Change: use yml, which is easier to parse, as the config format

This commit is contained in:
Dreamacro
2018-10-02 15:26:36 +08:00
parent 16c9445459
commit 5c7fa6b18b
12 changed files with 222 additions and 186 deletions

View File

@ -31,6 +31,12 @@ type Socks5 struct {
name string
}
type Socks5Option struct {
Name string `proxy:"name"`
Server string `proxy:"server"`
Port int `proxy:"port"`
}
func (ss *Socks5) Name() string {
return ss.name
}
@ -82,9 +88,9 @@ func (ss *Socks5) shakeHand(metadata *C.Metadata, rw io.ReadWriter) error {
return nil
}
func NewSocks5(name, addr string) *Socks5 {
func NewSocks5(option Socks5Option) *Socks5 {
return &Socks5{
addr: addr,
name: name,
addr: fmt.Sprintf("%s:%d", option.Server, option.Port),
name: option.Name,
}
}