File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -59,16 +59,18 @@ func NewServerStampFromString(stampStr string) (ServerStamp, error) {
5959 if len (bin ) < 1 {
6060 return ServerStamp {}, errors .New ("Stamp is too short" )
6161 }
62- if bin [0 ] ! = uint8 (StampProtoTypeDNSCrypt ) {
62+ if bin [0 ] = = uint8 (StampProtoTypeDNSCrypt ) {
6363 return newDNSCryptServerStamp (bin )
64+ } else if bin [0 ] == uint8 (StampProtoTypeDoH ) {
65+ return newDoHServerStamp (bin )
6466 }
6567 return ServerStamp {}, errors .New ("Unsupported stamp version or protocol" )
6668}
6769
6870// id(u8)=0x02 props addrLen(1) serverAddr pkStrlen(1) pkStr providerNameLen(1) providerName
6971
7072func newDNSCryptServerStamp (bin []byte ) (ServerStamp , error ) {
71- stamp := ServerStamp {}
73+ stamp := ServerStamp {proto : StampProtoTypeDNSCrypt }
7274 if len (bin ) < 24 {
7375 return stamp , errors .New ("Stamp is too short" )
7476 }
@@ -109,7 +111,7 @@ func newDNSCryptServerStamp(bin []byte) (ServerStamp, error) {
109111// id(u8)=0x02 props addrLen(1) serverAddr hashLen(1) hash providerNameLen(1) providerName pathLen(1) path
110112
111113func newDoHServerStamp (bin []byte ) (ServerStamp , error ) {
112- stamp := ServerStamp {}
114+ stamp := ServerStamp {proto : StampProtoTypeDoH }
113115
114116 stamp .props = ServerInformalProperties (binary .LittleEndian .Uint64 (bin [1 :9 ]))
115117 binLen := len (bin )
You can’t perform that action at this time.
0 commit comments