Chore: throw more detail dial error

This commit is contained in:
Dreamacro
2019-12-05 17:51:21 +08:00
parent ad53b42a68
commit b8267a69f6
4 changed files with 13 additions and 13 deletions

View File

@ -30,7 +30,7 @@ type SnellOption struct {
func (s *Snell) DialContext(ctx context.Context, metadata *C.Metadata) (C.Conn, error) {
c, err := dialContext(ctx, "tcp", s.server)
if err != nil {
return nil, fmt.Errorf("%s connect error: %s", s.server, err.Error())
return nil, fmt.Errorf("%s connect error: %w", s.server, err)
}
tcpKeepAlive(c)
switch s.obfsOption.Mode {
@ -53,7 +53,7 @@ func NewSnell(option SnellOption) (*Snell, error) {
decoder := structure.NewDecoder(structure.Option{TagName: "obfs", WeaklyTypedInput: true})
obfsOption := &simpleObfsOption{Host: "bing.com"}
if err := decoder.Decode(option.ObfsOpts, obfsOption); err != nil {
return nil, fmt.Errorf("snell %s initialize obfs error: %s", server, err.Error())
return nil, fmt.Errorf("snell %s initialize obfs error: %w", server, err)
}
if obfsOption.Mode != "tls" && obfsOption.Mode != "http" {