status-go/vendor/github.com/libp2p/go-reuseport
RichΛrd 40359f9c1b
go-waku integration (#2247)
* Adding wakunode module
* Adding wakuv2 fleet files
* Add waku fleets to update-fleet-config script
* Adding config items for waku v2
* Conditionally start waku v2 node depending on config
* Adapting common code to use go-waku
* Setting log level to info
* update dependencies
* update fleet config to use WakuNodes instead of BootNodes
* send and receive messages
* use hash returned when publishing a message
* add waku store protocol
* trigger signal after receiving store messages
* exclude linting rule SA1019 to check deprecated packages
2021-06-16 16:19:45 -04:00
..
.travis.yml go-waku integration (#2247) 2021-06-16 16:19:45 -04:00
LICENSE
README.md go-waku integration (#2247) 2021-06-16 16:19:45 -04:00
addr.go
codecov.yml migrate to go 1.12 and go modules 2019-06-12 13:12:00 +02:00
control_plan9.go go-waku integration (#2247) 2021-06-16 16:19:45 -04:00
control_unix.go go-waku integration (#2247) 2021-06-16 16:19:45 -04:00
control_wasm.go migrate to go 1.12 and go modules 2019-06-12 13:12:00 +02:00
control_windows.go migrate to go 1.12 and go modules 2019-06-12 13:12:00 +02:00
go.mod go-waku integration (#2247) 2021-06-16 16:19:45 -04:00
go.sum go-waku integration (#2247) 2021-06-16 16:19:45 -04:00
interface.go migrate to go 1.12 and go modules 2019-06-12 13:12:00 +02:00

README.md

go-reuseport

codecov Travis CI Discourse posts

NOTE: This package REQUIRES go >= 1.11.

This package enables listening and dialing from the same TCP or UDP port. This means that the following sockopts may be set:

SO_REUSEADDR
SO_REUSEPORT

This is a simple package to help with address reuse. This is particularly important when attempting to do TCP NAT holepunching, which requires a process to both Listen and Dial on the same TCP port. This package provides some utilities around enabling this behaviour on various OS.

Examples

// listen on the same port. oh yeah.
l1, _ := reuse.Listen("tcp", "127.0.0.1:1234")
l2, _ := reuse.Listen("tcp", "127.0.0.1:1234")
// dial from the same port. oh yeah.
l1, _ := reuse.Listen("tcp", "127.0.0.1:1234")
l2, _ := reuse.Listen("tcp", "127.0.0.1:1235")
c, _ := reuse.Dial("tcp", "127.0.0.1:1234", "127.0.0.1:1235")

Note: cant dial self because tcp/ip stacks use 4-tuples to identify connections, and doing so would clash.

Tested

Tested on darwin, linux, and windows.


The last gx published version of this module was: 0.2.2: Qme8kdM7thoCqLqd7GYCRqipoZJS64rhJo5MBcTpyWfsL9