mirror of
https://github.com/shtorm-7/sing-box-extended.git
synced 2026-12-01 14:18:36 +00:00
Fix IPv6 literal host handling
This commit is contained in:
+7
-10
@@ -5,10 +5,8 @@ import (
|
||||
"context"
|
||||
"errors"
|
||||
"io"
|
||||
"net"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strconv"
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
"time"
|
||||
@@ -82,15 +80,14 @@ func NewHTTPS(ctx context.Context, logger log.ContextLogger, tag string, options
|
||||
host = options.Server
|
||||
}
|
||||
}
|
||||
destinationURL := url.URL{
|
||||
Scheme: "https",
|
||||
Host: host,
|
||||
}
|
||||
if destinationURL.Host == "" {
|
||||
destinationURL.Host = options.Server
|
||||
}
|
||||
destinationAddress := M.ParseSocksaddrHostPort(host, options.ServerPort)
|
||||
destinationURL := url.URL{Scheme: "https"}
|
||||
if options.ServerPort != 0 && options.ServerPort != 443 {
|
||||
destinationURL.Host = net.JoinHostPort(destinationURL.Host, strconv.Itoa(int(options.ServerPort)))
|
||||
destinationURL.Host = destinationAddress.String()
|
||||
} else if destinationAddress.IsIPv6() {
|
||||
destinationURL.Host = "[" + destinationAddress.AddrString() + "]"
|
||||
} else {
|
||||
destinationURL.Host = destinationAddress.AddrString()
|
||||
}
|
||||
path := options.Path
|
||||
if path == "" {
|
||||
|
||||
Reference in New Issue
Block a user