From ea706dc06b678e5741d415133ec9ed57e63994de Mon Sep 17 00:00:00 2001 From: Dingjun Date: Fri, 15 Sep 2017 11:34:07 +0800 Subject: [PATCH] update sample code --- README.md | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 9e54b10..2aad11a 100644 --- a/README.md +++ b/README.md @@ -23,14 +23,21 @@ server usage example cert, err := tls.LoadX509KeyPair(certFile, keyFile) l, err = tls.Listen("tcp", ":2022", &tls.Config{ Certificates: []tls.Certificate{cert}, + } }else{ l, err = net.Listen(":2022") } - c, err := l.Accept() - - sc, err := obfssh.NewServer(c, config, &obfssh.Conf{}) - - sc.Run() + + defer l.Close() + + 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