ehang-io / nps-mux Goto Github PK
View Code? Open in Web Editor NEWA net connection multiplexing implementation based on golang
Home Page: https://ehang.io/nps/documents
License: GNU General Public License v3.0
A net connection multiplexing implementation based on golang
Home Page: https://ehang.io/nps/documents
License: GNU General Public License v3.0
Binary.Read and binary.Write use reflection and are slow
All the stream data split or combination are using it in netpackager.go
Maybe we need to do it by hand
Cost of calls via interfaces, in mux.go
Maybe we should call tcp or kcp connection directly
没有详细的文档很难理解,能否给你个example帮助用户理解使用mux?
Support data encryption
GC will check all the pointers in map
We use it in map.go
Maybe we should use uintptr instead of pointer
sync map instead of map and RWmutex, atomic value provides Len method, range a list and delete outside
从nps源码过来的,文档上的usage真心看不懂呀
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x4 pc=0x12464]
goroutine 34 [running]:
ehang.io/nps/lib/mux.(*ReceiveWindowQueue).Pop(0x21aa0d8, 0x513eb0, 0x216c2d0, 0xe716f753)
/home/travis/gopath/src/github.com/ehang-io/nps/lib/mux/queue.go:254 +0x48
ehang.io/nps/lib/mux.(*ReceiveWindow).readFromQueue(0x21aa0c0, 0x21ca024, 0x4, 0x4, 0x1, 0x26214, 0xa48388, 0x0)
/home/travis/gopath/src/github.com/ehang-io/nps/lib/mux/conn.go:346 +0x230
ehang.io/nps/lib/mux.(*ReceiveWindow).Read(0x21aa0c0, 0x21ca024, 0x4, 0x4, 0x1, 0xa48388, 0x1, 0x32)
/home/travis/gopath/src/github.com/ehang-io/nps/lib/mux/conn.go:329 +0x58
ehang.io/nps/lib/mux.(*conn).Read(0x20fa060, 0x21ca024, 0x4, 0x4, 0x1b3d4, 0x0, 0x76f8cdf8)
/home/travis/gopath/src/github.com/ehang-io/nps/lib/mux/conn.go:63 +0xb0
ehang.io/nps/lib/conn.(*Conn).Read(0x20d80a0, 0x21ca024, 0x4, 0x4, 0x3f888, 0x1309e4, 0x4)
/home/travis/gopath/src/github.com/ehang-io/nps/lib/conn/conn.go:269 +0x128
io.ReadAtLeast(0x6a61a8, 0x20d80a0, 0x21ca024, 0x4, 0x4, 0x4, 0x0, 0x1b8a0, 0x19138)
/home/travis/.gimme/versions/go1.13.linux.amd64/src/io/io.go:310 +0x6c
io.ReadFull(...)
/home/travis/.gimme/versions/go1.13.linux.amd64/src/io/io.go:329
encoding/binary.Read(0x6a61a8, 0x20d80a0, 0x6ad940, 0xa51b50, 0x5167c8, 0x21ca020, 0x6, 0x14)
/home/travis/.gimme/versions/go1.13.linux.amd64/src/encoding/binary/binary.go:165 +0x378
ehang.io/nps/lib/conn.(*Conn).GetLen(...)
/home/travis/gopath/src/github.com/ehang-io/nps/lib/conn/conn.go:101
ehang.io/nps/lib/conn.(*Conn).getInfo(0x20d80a0, 0x50f978, 0x20dc008, 0x0, 0x0)
/home/travis/gopath/src/github.com/ehang-io/nps/lib/conn/conn.go:238 +0x100
ehang.io/nps/lib/conn.(*Conn).GetLinkInfo(...)
/home/travis/gopath/src/github.com/ehang-io/nps/lib/conn/conn.go:148
ehang.io/nps/client.(*TRPClient).handleChan(0x20f6140, 0x6ae030, 0x20fa060)
/home/travis/gopath/src/github.com/ehang-io/nps/client/client.go:169 +0x78
created by ehang.io/nps/client.(*TRPClient).newChan
/home/travis/gopath/src/github.com/ehang-io/nps/client/client.go:164 +0xe8
Expected behavior
A clear and concise description of what you expected to happen.
Screenshots or logs
Add screenshots or logs to help explain your problem.
Server (please complete the following information):
Client (please complete the following information):
Additional context
Add any other context about the problem here.
nps[19933]: panic: runtime error: slice bounds out of range [90:72]
nps[19933]: goroutine 1050459 [running]:
nps[19933]: ehang.io/nps-mux.(*sendWindow).WriteTo(0xc000818480, 0xc000341e20, 0x14, 0x1, 0xc000521548, 0x4042d0, 0xc000521728)
nps[19933]: /home/runner/go/pkg/mod/ehang.io/[email protected]/conn.go:554 +0x2f2
nps[19933]: ehang.io/nps-mux.(*sendWindow).WriteFull(0xc000818480, 0xc000735100, 0x48, 0x688, 0xc0000002be, 0x40a37f, 0xc000010000, 0xaa0b00)
nps[19933]: /home/runner/go/pkg/mod/ehang.io/[email protected]/conn.go:608 +0x8e
nps[19933]: ehang.io/nps-mux.(*conn).Write(0xc000a69b30, 0xc000735100, 0x48, 0x688, 0xc000521638, 0x40b905, 0xaa0b00)
nps[19933]: /home/runner/go/pkg/mod/ehang.io/[email protected]/conn.go:63 +0x8e
nps[19933]: ehang.io/nps/lib/rate.(*rateConn).Write(0xc000ad41a0, 0xc000735100, 0x48, 0x688, 0xc000ad41a0, 0x1, 0xc0005216e8)
nps[19933]: /home/runner/work/nps/nps/lib/rate/conn.go:28 +0x55
nps[19933]: ehang.io/nps/server/proxy.(*UdpModeServer).process(0xc000490bd0, 0xc00011ac00, 0xc000735100, 0x48, 0x688)
nps[19933]: /home/runner/work/nps/nps/server/proxy/udp.go:59 +0x8e3
nps[19933]: created by ehang.io/nps/server/proxy.(*UdpModeServer).Start
nps[19933]: /home/runner/work/nps/nps/server/proxy/udp.go:50 +0x2cc
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.