Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
github.com/fwhezfwhez/tcpx
A very convenient tcp framework in golang.
go get github.com/fwhezfwhez/tcpx
if you want to run program in this repo,you should prepare protoc,proto-gen-go environment.
It's good to compile yourself from these repos,but there is already release versions referring to their doc.
Make sure run protoc --version
available.
protoc: https://github.com/golang/protobuf
proto-gen-go:https://github.com/golang/protobuf/tree/master/protoc-gen-go
https://github.com/fwhezfwhez/tcpx/blob/master/benchmark_test.go
cases | exec times | cost time per loop | cost mem per loop | cost object num per loop | url |
---|---|---|---|---|---|
OnMessage | 2000000 | 643 ns/op | 1368 B/op | 5 allocs/op | click to location |
Mux without middleware | 2000000 | 761 ns/op | 1368 B/op | 5 allocs/op | click to location |
Mux with middleware | 2000000 | 768 ns/op | 1368 B/op | 5 allocs/op | click to location |
Tcpx has its well-designed pack. To focus on detail, you can refer to: https://github.com/fwhezfwhez/tcpx/tree/master/examples/modules/pack-detail
[4]byte -- length fixed_size,binary big endian encode
[4]byte -- messageID fixed_size,binary big endian encode
[4]byte -- headerLength fixed_size,binary big endian encode
[4]byte -- bodyLength fixed_size,binary big endian encode
[]byte -- header marshal by json
[]byte -- body marshal by marshaller
According to this pack rule, tcpx has 2 well-designed routing ways and their pack structure:
messageID type pack
header:
{
"Router-Type": "MESSAGE_ID"
}
urlPattern pack
header:
{
"Router-Type": "URL_PATTERN"
"Router-Pattern-Value": "/login/"
}
https://github.com/fwhezfwhez/tcpx/tree/master/examples/modules/chat
It examples a chat using tcpx.
https://github.com/fwhezfwhez/tcpx/tree/master/examples/modules/raw
It examples how to send stream without rule, nothing to do with messageID/urlPattern system
. You can send all stream you want. Global middleware and anchor middleware are still working as the example said.
Here is an example of IM system using tcpx.
https://github.com/q1n9-jair/tcpx-demo
FAQs
Unknown package
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.