Code formatting for TRIS test client and server
This commit is contained in:
parent
9557e92e52
commit
3f720fc50c
@ -2,6 +2,7 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"crypto/tls"
|
"crypto/tls"
|
||||||
|
"crypto/x509"
|
||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
"flag"
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
@ -10,7 +11,6 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
"time"
|
"time"
|
||||||
"crypto/x509"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type ZeroRTT_t int
|
type ZeroRTT_t int
|
||||||
@ -62,7 +62,7 @@ func (s *server) start() {
|
|||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
var Max0RTTDataSize uint32
|
var Max0RTTDataSize uint32
|
||||||
if ((s.ZeroRTT&ZeroRTT_Offer) == ZeroRTT_Offer) {
|
if (s.ZeroRTT & ZeroRTT_Offer) == ZeroRTT_Offer {
|
||||||
Max0RTTDataSize = 100 * 1024
|
Max0RTTDataSize = 100 * 1024
|
||||||
}
|
}
|
||||||
var keyLogWriter io.Writer
|
var keyLogWriter io.Writer
|
||||||
@ -82,7 +82,7 @@ func (s *server) start() {
|
|||||||
TLSConfig: &tls.Config{
|
TLSConfig: &tls.Config{
|
||||||
Certificates: []tls.Certificate{cert},
|
Certificates: []tls.Certificate{cert},
|
||||||
Max0RTTDataSize: Max0RTTDataSize,
|
Max0RTTDataSize: Max0RTTDataSize,
|
||||||
Accept0RTTData: (s.ZeroRTT&ZeroRTT_Accept) == ZeroRTT_Accept,
|
Accept0RTTData: (s.ZeroRTT & ZeroRTT_Accept) == ZeroRTT_Accept,
|
||||||
KeyLogWriter: keyLogWriter,
|
KeyLogWriter: keyLogWriter,
|
||||||
GetConfigForClient: func(*tls.ClientHelloInfo) (*tls.Config, error) {
|
GetConfigForClient: func(*tls.ClientHelloInfo) (*tls.Config, error) {
|
||||||
// If we send the first flight too fast, NSS sends empty early data.
|
// If we send the first flight too fast, NSS sends empty early data.
|
||||||
@ -101,14 +101,14 @@ func main() {
|
|||||||
|
|
||||||
s := NewServer()
|
s := NewServer()
|
||||||
|
|
||||||
arg_addr := flag.String("b" , "0.0.0.0:443", "Address:port used for binding")
|
arg_addr := flag.String("b", "0.0.0.0:443", "Address:port used for binding")
|
||||||
arg_palg := flag.String("palg", "rsa", "Public algorithm to use: rsa or ecdsa")
|
arg_palg := flag.String("palg", "rsa", "Public algorithm to use: rsa or ecdsa")
|
||||||
arg_zerortt := flag.String("rtt0", "n", `0-RTT, accepts following values [n: None, a: Accept, o: Offer, oa: Offer and Accept]`)
|
arg_zerortt := flag.String("rtt0", "n", `0-RTT, accepts following values [n: None, a: Accept, o: Offer, oa: Offer and Accept]`)
|
||||||
arg_confirm := flag.Bool("rtt0ack", false, "0-RTT confirm")
|
arg_confirm := flag.Bool("rtt0ack", false, "0-RTT confirm")
|
||||||
arg_clientauth := flag.Bool("cliauth", false, "Performs client authentication (RequireAndVerifyClientCert used)")
|
arg_clientauth := flag.Bool("cliauth", false, "Performs client authentication (RequireAndVerifyClientCert used)")
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
s.Address=*arg_addr
|
s.Address = *arg_addr
|
||||||
|
|
||||||
if *arg_palg == "ecdsa" {
|
if *arg_palg == "ecdsa" {
|
||||||
s.PubKey = PubKeyECDSA
|
s.PubKey = PubKeyECDSA
|
||||||
|
@ -127,7 +127,6 @@ func main() {
|
|||||||
client.run(addr, tls.VersionTLS12, tls.TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256)
|
client.run(addr, tls.VersionTLS12, tls.TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
client.run(addr, tls.VersionTLS13, tls.TLS_CHACHA20_POLY1305_SHA256)
|
client.run(addr, tls.VersionTLS13, tls.TLS_CHACHA20_POLY1305_SHA256)
|
||||||
client.run(addr, tls.VersionTLS13, tls.TLS_AES_128_GCM_SHA256)
|
client.run(addr, tls.VersionTLS13, tls.TLS_AES_128_GCM_SHA256)
|
||||||
client.run(addr, tls.VersionTLS13, tls.TLS_AES_256_GCM_SHA384)
|
client.run(addr, tls.VersionTLS13, tls.TLS_AES_256_GCM_SHA384)
|
||||||
@ -226,4 +225,3 @@ LAoibwDU1NC8/3MfOBYMe6Qklu3kjexOJrfdo0Z7Khgd9F8A4tKwslUndSSlAfKF
|
|||||||
2rjfqabVMZMLZ2XEbA4W5JTfaZS4YYGcrjY7+i7OsnSxoYG2sb+xlQ==
|
2rjfqabVMZMLZ2XEbA4W5JTfaZS4YYGcrjY7+i7OsnSxoYG2sb+xlQ==
|
||||||
-----END RSA PRIVATE KEY-----`
|
-----END RSA PRIVATE KEY-----`
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user