Remove unneeded port numbers

This commit is contained in:
Frank Denis 2018-01-30 16:10:46 +01:00
parent c39197f7b2
commit ce2a730ab7
2 changed files with 15 additions and 7 deletions

View File

@ -274,6 +274,6 @@ format = 'tsv'
## Optional, local, static list of additional servers
## Mostly useful for testing your own servers.
[static]
[static.'google']
stamp = 'sdns://AgEAAAAAAAAADTIxNi41OC4yMDUuNzgg8lxq3HOXjXnCfJ6JiQifqungi0xJ-mx4nNIVhlMGEGgOZG5zLmdvb2dsZS5jb20NL2V4cGVyaW1lbnRhbA'
# [static]
# [static.'google']
# stamp = 'sdns://AgEAAAAAAAAAACDyXGrcc5eNecJ8nomJCJ-q6eCLTEn6bHic0hWGUwYQaA5kbnMuZ29vZ2xlLmNvbQ0vZXhwZXJpbWVudGFs'

View File

@ -176,8 +176,12 @@ func (stamp *ServerStamp) dnsCryptString() string {
bin[0] = uint8(StampProtoTypeDNSCrypt)
binary.LittleEndian.PutUint64(bin[1:9], uint64(stamp.props))
bin = append(bin, uint8(len(stamp.serverAddrStr)))
bin = append(bin, []uint8(stamp.serverAddrStr)...)
serverAddrStr := stamp.serverAddrStr
if strings.HasSuffix(serverAddrStr, ":"+string(DefaultPort)) {
serverAddrStr = serverAddrStr[:1+len(string(DefaultPort))]
}
bin = append(bin, uint8(len(serverAddrStr)))
bin = append(bin, []uint8(serverAddrStr)...)
bin = append(bin, uint8(len(stamp.serverPk)))
bin = append(bin, stamp.serverPk...)
@ -195,8 +199,12 @@ func (stamp *ServerStamp) dohString() string {
bin[0] = uint8(StampProtoTypeDoH)
binary.LittleEndian.PutUint64(bin[1:9], uint64(stamp.props))
bin = append(bin, uint8(len(stamp.serverAddrStr)))
bin = append(bin, []uint8(stamp.serverAddrStr)...)
serverAddrStr := stamp.serverAddrStr
if strings.HasSuffix(serverAddrStr, ":"+string(DefaultPort)) {
serverAddrStr = serverAddrStr[:1+len(string(DefaultPort))]
}
bin = append(bin, uint8(len(serverAddrStr)))
bin = append(bin, []uint8(serverAddrStr)...)
bin = append(bin, uint8(len(stamp.hash)))
bin = append(bin, []uint8(stamp.hash)...)