This commit is contained in:
qowevisa 2024-02-23 19:42:31 +02:00
parent 1592590883
commit d0f7121fb1
2 changed files with 3 additions and 1 deletions

View File

@ -33,8 +33,9 @@ func main() {
if !ok {
log.Fatal("failed to parse root certificate")
}
config := &tls.Config{RootCAs: roots, ServerName: "localhost"}
config := &tls.Config{RootCAs: roots, ServerName: "my-server"}
log.Printf("Trying to dial %s:%d\n", host, port)
connp, err := net.Dial("tcp", fmt.Sprintf("%s:%d", host, port))
if err != nil {
log.Fatal(err)

View File

@ -36,6 +36,7 @@ func main() {
config := &tls.Config{Certificates: []tls.Certificate{cer}}
//
log.Printf("Serving on %s:%d\n", host, port)
l, err := tls.Listen("tcp", fmt.Sprintf("%s:%d", host, port), config)
if err != nil {
log.Fatal(err)