mirror of
https://github.com/DNSCrypt/dnscrypt-proxy.git
synced 2025-03-04 10:24:40 +01:00
Properly remove the default port
This commit is contained in:
parent
e4e351b854
commit
c5283061cf
1 changed files with 5 additions and 4 deletions
|
@ -7,6 +7,7 @@ import (
|
|||
"errors"
|
||||
"fmt"
|
||||
"net"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/jedisct1/dlog"
|
||||
|
@ -196,8 +197,8 @@ func (stamp *ServerStamp) dnsCryptString() string {
|
|||
binary.LittleEndian.PutUint64(bin[1:9], uint64(stamp.props))
|
||||
|
||||
serverAddrStr := stamp.serverAddrStr
|
||||
if strings.HasSuffix(serverAddrStr, ":"+string(DefaultPort)) {
|
||||
serverAddrStr = serverAddrStr[:1+len(string(DefaultPort))]
|
||||
if strings.HasSuffix(serverAddrStr, ":"+strconv.Itoa(DefaultPort)) {
|
||||
serverAddrStr = serverAddrStr[:len(serverAddrStr)-1-len(strconv.Itoa(DefaultPort))]
|
||||
}
|
||||
bin = append(bin, uint8(len(serverAddrStr)))
|
||||
bin = append(bin, []uint8(serverAddrStr)...)
|
||||
|
@ -219,8 +220,8 @@ func (stamp *ServerStamp) dohString() string {
|
|||
binary.LittleEndian.PutUint64(bin[1:9], uint64(stamp.props))
|
||||
|
||||
serverAddrStr := stamp.serverAddrStr
|
||||
if strings.HasSuffix(serverAddrStr, ":"+string(DefaultPort)) {
|
||||
serverAddrStr = serverAddrStr[:1+len(string(DefaultPort))]
|
||||
if strings.HasSuffix(serverAddrStr, ":"+strconv.Itoa(DefaultPort)) {
|
||||
serverAddrStr = serverAddrStr[:len(serverAddrStr)-1-len(strconv.Itoa(DefaultPort))]
|
||||
}
|
||||
bin = append(bin, uint8(len(serverAddrStr)))
|
||||
bin = append(bin, []uint8(serverAddrStr)...)
|
||||
|
|
Loading…
Add table
Reference in a new issue