3f73c82d00
- Bump go-shadowsocks2 to v0.1.3 (new API symbols) - Return error instead of nil when Target() is empty in TCP handler - Reset wbuf unconditionally on write error to prevent unbounded growth - Add nil guard on targetAddr before WriteTo to prevent panic - Remove duplicate NewClientConfig call and dead ClientConfig literal - Remove unused noDelay metadata field - Fix buffer-size guard to catch negative values (len(b)==0 → bufSize<=0) - Add address context to parse/session error messages
26 lines
446 B
Go
26 lines
446 B
Go
package ss
|
|
|
|
import (
|
|
"time"
|
|
|
|
mdata "github.com/go-gost/core/metadata"
|
|
mdutil "github.com/go-gost/x/metadata/util"
|
|
)
|
|
|
|
type metadata struct {
|
|
key string
|
|
connectTimeout time.Duration
|
|
}
|
|
|
|
func (c *ssConnector) parseMetadata(md mdata.Metadata) (err error) {
|
|
const (
|
|
key = "key"
|
|
connectTimeout = "timeout"
|
|
)
|
|
|
|
c.md.key = mdutil.GetString(md, key)
|
|
c.md.connectTimeout = mdutil.GetDuration(md, connectTimeout)
|
|
|
|
return
|
|
}
|