|
|
@ -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()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sc, err := obfssh.NewServer(c, config, &obfssh.Conf{})
|
|
|
|
defer l.Close()
|
|
|
|
|
|
|
|
|
|
|
|
sc.Run()
|
|
|
|
for {
|
|
|
|
|
|
|
|
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
|
|
|
|