Skip to content

Commit

Permalink
Fix parsing UDP transport
Browse files Browse the repository at this point in the history
  • Loading branch information
nekohasekai committed Feb 22, 2024
1 parent 9a328d8 commit 498f63b
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions transport_udp.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,12 @@ type UDPTransport struct {
}

func NewUDPTransport(options TransportOptions) (*UDPTransport, error) {
serverURL, err := url.Parse(options.Address)
if err != nil {
return nil, err
}
if serverURL.Scheme == "" {
serverURL.Host = serverURL.Path
serverURL.Path = ""
var serverAddr M.Socksaddr
if serverURL, err := url.Parse(options.Address); err != nil || serverURL.Scheme == "" {
serverAddr = M.ParseSocksaddr(options.Address)
} else {
serverAddr = M.ParseSocksaddr(serverURL.Host)
}
serverAddr := M.ParseSocksaddr(serverURL.Host)
if !serverAddr.IsValid() {
return nil, E.New("invalid server address")
}
Expand Down

0 comments on commit 498f63b

Please sign in to comment.