Code formatting for TRIS test client and server

This commit is contained in:
Henry Case 2018-06-26 08:02:26 +01:00 committed by Henry Dorsett Case
parent 9557e92e52
commit 3f720fc50c
2 changed files with 41 additions and 43 deletions

View File

@ -2,6 +2,7 @@ package main
import (
"crypto/tls"
"crypto/x509"
"encoding/hex"
"flag"
"fmt"
@ -10,7 +11,6 @@ import (
"net/http"
"os"
"time"
"crypto/x509"
)
type ZeroRTT_t int
@ -62,7 +62,7 @@ func (s *server) start() {
log.Fatal(err)
}
var Max0RTTDataSize uint32
if ((s.ZeroRTT&ZeroRTT_Offer) == ZeroRTT_Offer) {
if (s.ZeroRTT & ZeroRTT_Offer) == ZeroRTT_Offer {
Max0RTTDataSize = 100 * 1024
}
var keyLogWriter io.Writer
@ -82,7 +82,7 @@ func (s *server) start() {
TLSConfig: &tls.Config{
Certificates: []tls.Certificate{cert},
Max0RTTDataSize: Max0RTTDataSize,
Accept0RTTData: (s.ZeroRTT&ZeroRTT_Accept) == ZeroRTT_Accept,
Accept0RTTData: (s.ZeroRTT & ZeroRTT_Accept) == ZeroRTT_Accept,
KeyLogWriter: keyLogWriter,
GetConfigForClient: func(*tls.ClientHelloInfo) (*tls.Config, error) {
// If we send the first flight too fast, NSS sends empty early data.
@ -101,14 +101,14 @@ func main() {
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_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_clientauth := flag.Bool("cliauth", false, "Performs client authentication (RequireAndVerifyClientCert used)")
flag.Parse()
s.Address=*arg_addr
s.Address = *arg_addr
if *arg_palg == "ecdsa" {
s.PubKey = PubKeyECDSA

View File

@ -127,7 +127,6 @@ func main() {
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_AES_128_GCM_SHA256)
client.run(addr, tls.VersionTLS13, tls.TLS_AES_256_GCM_SHA384)
@ -226,4 +225,3 @@ LAoibwDU1NC8/3MfOBYMe6Qklu3kjexOJrfdo0Z7Khgd9F8A4tKwslUndSSlAfKF
2rjfqabVMZMLZ2XEbA4W5JTfaZS4YYGcrjY7+i7OsnSxoYG2sb+xlQ==
-----END RSA PRIVATE KEY-----`
)