diff --git a/go.mod b/go.mod index 3e638b7f..4ea09f80 100644 --- a/go.mod +++ b/go.mod @@ -17,6 +17,7 @@ require ( github.com/oschwald/geoip2-golang v1.9.0 github.com/refraction-networking/utls v1.6.4 github.com/samber/slog-formatter v1.0.0 + github.com/segmentio/encoding v0.4.0 github.com/smallnest/ringbuffer v0.0.0-20230728150354-35801fa39d0e github.com/stretchr/testify v1.9.0 github.com/txthinking/socks5 v0.0.0-20230325130024-4230056ae301 @@ -67,6 +68,7 @@ require ( github.com/quic-go/quic-go v0.42.0 // indirect github.com/samber/lo v1.38.1 // indirect github.com/samber/slog-multi v1.0.0 // indirect + github.com/segmentio/asm v1.1.3 // indirect github.com/sirupsen/logrus v1.9.3 // indirect github.com/txthinking/runnergroup v0.0.0-20210608031112-152c7c4432bf // indirect github.com/zeebo/blake3 v0.2.3 // indirect diff --git a/go.sum b/go.sum index 66e3a2b6..01caad0c 100644 --- a/go.sum +++ b/go.sum @@ -127,6 +127,10 @@ github.com/samber/slog-formatter v1.0.0 h1:ULxHV+jNqi6aFP8xtzGHl2ejFRMl2+jI2UhCp github.com/samber/slog-formatter v1.0.0/go.mod h1:c7pRfwhCfZQNzJz+XirmTveElxXln7M0Y8Pq781uxlo= github.com/samber/slog-multi v1.0.0 h1:snvP/P5GLQ8TQh5WSqdRaxDANW8AAA3egwEoytLsqvc= github.com/samber/slog-multi v1.0.0/go.mod h1:uLAvHpGqbYgX4FSL0p1ZwoLuveIAJvBECtE07XmYvFo= +github.com/segmentio/asm v1.1.3 h1:WM03sfUOENvvKexOLp+pCqgb/WDjsi7EK8gIsICtzhc= +github.com/segmentio/asm v1.1.3/go.mod h1:Ld3L4ZXGNcSLRg4JBsZ3//1+f/TjYl0Mzen/DQy1EJg= +github.com/segmentio/encoding v0.4.0 h1:MEBYvRqiUB2nfR2criEXWqwdY6HJOUrCn5hboVOVmy8= +github.com/segmentio/encoding v0.4.0/go.mod h1:/d03Cd8PoaDeceuhUUUQWjU0KhWjrmYrWPgtJHYZSnI= github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/skratchdot/open-golang v0.0.0-20200116055534-eef842397966/go.mod h1:sUM3LWHvSMaG192sy56D9F7CNvL7jUJVXoqM1QKLnog= diff --git a/httptunnel/local_conn.go b/httptunnel/local_conn.go index d9d15d2b..2eadda91 100644 --- a/httptunnel/local_conn.go +++ b/httptunnel/local_conn.go @@ -17,6 +17,7 @@ import ( "github.com/nange/easyss/v2/log" "github.com/nange/easyss/v2/util/bytespool" "github.com/nange/easyss/v2/util/netpipe" + json2 "github.com/segmentio/encoding/json" ) const ( @@ -209,7 +210,7 @@ func (l *LocalConn) Read(b []byte) (int, error) { p := &pushPayload{} _ = faker.FakeData(p) p.Payload = base64.StdEncoding.EncodeToString(buf[:n]) - payload, _ = json.Marshal(p) + payload, _ = json2.Marshal(p) } cn := copy(b, payload) diff --git a/httptunnel/server.go b/httptunnel/server.go index 60c274c9..571c3124 100644 --- a/httptunnel/server.go +++ b/httptunnel/server.go @@ -3,7 +3,6 @@ package httptunnel import ( "crypto/tls" "encoding/base64" - "encoding/json" "errors" "io" "net" @@ -18,6 +17,7 @@ import ( "github.com/nange/easyss/v2/log" "github.com/nange/easyss/v2/util/bytespool" "github.com/nange/easyss/v2/util/netpipe" + "github.com/segmentio/encoding/json" ) const RelayBufferSize = cipherstream.MaxCipherRelaySize