update sample code

tls
Dingjun 7 years ago
parent d7abfb0d26
commit ea706dc06b

@ -23,14 +23,21 @@ server usage example
cert, err := tls.LoadX509KeyPair(certFile, keyFile) cert, err := tls.LoadX509KeyPair(certFile, keyFile)
l, err = tls.Listen("tcp", ":2022", &tls.Config{ l, err = tls.Listen("tcp", ":2022", &tls.Config{
Certificates: []tls.Certificate{cert}, Certificates: []tls.Certificate{cert},
}
}else{ }else{
l, err = net.Listen(":2022") l, err = net.Listen(":2022")
} }
c, err := l.Accept()
defer l.Close()
sc, err := obfssh.NewServer(c, config, &obfssh.Conf{})
for {
sc.Run() c, err := l.Accept()
go func(c net.Conn){
defer c.Close()
sc, err := obfssh.NewServer(c, config, &obfssh.Conf{})
sc.Run()
}(c)
}
client usage example client usage example

Loading…
Cancel
Save