forked from quic-go/quic-go
implement sample server REJ message in example server
This commit is contained in:
@@ -15,6 +15,8 @@ const (
|
||||
TagCHLO Tag = 'C' + 'H'<<8 + 'L'<<16 + 'O'<<24
|
||||
// TagREJ is a server hello rejection
|
||||
TagREJ Tag = 'R' + 'E'<<8 + 'J'<<16
|
||||
// TagSCFG is a server config
|
||||
TagSCFG Tag = 'S' + 'C'<<8 + 'F'<<16 + 'G'<<24
|
||||
|
||||
// TagPAD is padding
|
||||
TagPAD Tag = 'P' + 'A'<<8 + 'D'<<16
|
||||
@@ -49,14 +51,25 @@ const (
|
||||
// TagSFCW is the initial stream flow control receive window.
|
||||
TagSFCW Tag = 'S' + 'F'<<8 + 'C'<<16 + 'W'<<24
|
||||
|
||||
// TagSCFG is the server config
|
||||
TagSCFG Tag = 'S' + 'C'<<8 + 'F'<<16 + 'G'<<24
|
||||
// TagSTK is the source-address token
|
||||
TagSTK Tag = 'S' + 'T'<<8 + 'K'<<16
|
||||
// TagSNO is the server nonce
|
||||
TagSNO Tag = 'S' + 'N'<<8 + 'O'<<16
|
||||
// TagPROF is the server proof
|
||||
TagPROF Tag = 'P' + 'R'<<8 + 'O'<<16 + 'F'<<24
|
||||
|
||||
// TagSCID is the server config ID
|
||||
TagSCID Tag = 'S' + 'C'<<8 + 'I'<<16 + 'D'<<24
|
||||
// TagKEXS is the list of key exchange algos
|
||||
TagKEXS Tag = 'K' + 'E'<<8 + 'X'<<16 + 'S'<<24
|
||||
// TagAEAD is the list of AEAD algos
|
||||
TagAEAD Tag = 'A' + 'E'<<8 + 'A'<<16 + 'D'<<24
|
||||
// TagPUBS is the public value for the KEX
|
||||
TagPUBS Tag = 'P' + 'U'<<8 + 'B'<<16 + 'S'<<24
|
||||
// TagORBT is the client orbit
|
||||
TagORBT Tag = 'O' + 'R'<<8 + 'B'<<16 + 'T'<<24
|
||||
// TagEXPY is the server config expiry
|
||||
TagEXPY Tag = 'E' + 'X'<<8 + 'P'<<16 + 'Y'<<24
|
||||
)
|
||||
|
||||
var (
|
||||
|
||||
@@ -68,4 +68,20 @@ func main() {
|
||||
|
||||
fmt.Printf("Tag: %d\n", messageTag)
|
||||
fmt.Printf("Talking to: %s\n", string(cryptoData[quic.TagUAID]))
|
||||
|
||||
serverConfig := &bytes.Buffer{}
|
||||
quic.WriteCryptoMessage(serverConfig, quic.TagSCFG, map[quic.Tag][]byte{
|
||||
quic.TagSCID: []byte{0xC5, 0x1C, 0x73, 0x6B, 0x8F, 0x48, 0x49, 0xAE, 0xB3, 0x00, 0xA2, 0xD4, 0x4B, 0xA0, 0xCF, 0xDF},
|
||||
quic.TagKEXS: []byte("C255"),
|
||||
quic.TagAEAD: []byte("AESG"),
|
||||
quic.TagPUBS: []byte{},
|
||||
quic.TagORBT: []byte{0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7},
|
||||
quic.TagEXPY: []byte{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
|
||||
quic.TagVER: []byte("Q030"),
|
||||
})
|
||||
|
||||
serverReply := &bytes.Buffer{}
|
||||
quic.WriteCryptoMessage(serverReply, quic.TagREJ, map[quic.Tag][]byte{
|
||||
quic.TagSCFG: serverConfig.Bytes(),
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user