Security News
Maven Central Adds Sigstore Signature Validation
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
@libp2p/tcp
Advanced tools
A TCP transport for libp2p
$ npm i @libp2p/tcp
import { tcp } from '@libp2p/tcp'
import { multiaddr } from '@multiformats/multiaddr'
import { pipe } from 'it-pipe'
import all from 'it-all'
// A simple upgrader that just returns the MultiaddrConnection
const upgrader = {
upgradeInbound: async maConn => maConn,
upgradeOutbound: async maConn => maConn
}
const transport = tcp()()
const listener = transport.createListener({
upgrader,
handler: (socket) => {
console.log('new connection opened')
pipe(
['hello', ' ', 'World!'],
socket
)
}
})
const addr = multiaddr('/ip4/127.0.0.1/tcp/9090')
await listener.listen(addr)
console.log('listening')
const socket = await transport.dial(addr, { upgrader })
const values = await pipe(
socket,
all
)
console.log(`Value: ${values.toString()}`)
// Close connection after reading
await listener.close()
Outputs:
listening
new connection opened
Value: hello World!
Licensed under either of
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
FAQs
A TCP transport for libp2p
The npm package @libp2p/tcp receives a total of 8,690 weekly downloads. As such, @libp2p/tcp popularity was classified as popular.
We found that @libp2p/tcp demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 6 open source maintainers collaborating on the project.
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.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.