diff --git a/lib/tun2/.#server.go b/lib/tun2/.#server.go new file mode 120000 index 0000000..a16c320 --- /dev/null +++ b/lib/tun2/.#server.go @@ -0,0 +1 @@ +xena@greedo.xeserv.us.3075:1486865539 \ No newline at end of file diff --git a/lib/tun2/server.go b/lib/tun2/server.go index 74ff24d..af2b72c 100644 --- a/lib/tun2/server.go +++ b/lib/tun2/server.go @@ -7,6 +7,7 @@ import ( "encoding/json" "errors" "fmt" + "io/ioutil" "math/rand" "net" "net/http" @@ -153,12 +154,27 @@ func (s *Server) ListenAndServe() error { panic(err) } - _, err = s.RoundTrip(req) + stream, err := c.session.OpenStream() if err != nil { ln.Error(err) c.cancel() } + + err = req.Write(stream) + if err != nil { + ln.Error(err) + + c.cancel() + } + + _, err = ioutil.ReadAll(stream) + if err != nil { + ln.Error(err) + c.cancel() + } + + stream.Close() } s.connlock.Unlock() @@ -188,7 +204,7 @@ func (s *Server) HandleConn(c net.Conn, isKCP bool) { controlStream, err := session.OpenStream() if err != nil { ln.Error(err, ln.F{ - "action": "control_stream_failure", + "action": "control_stream_failure" "local": c.LocalAddr().String(), "remote": c.RemoteAddr().String(), })