THIS IS A TEST INSTANCE ONLY! REPOSITORIES CAN BE DELETED AT ANY TIME!

Test migration from a real existing repository ( https://github.com/libp2p/go-reuseport.git ) https://ddg.gg/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
random1234 31736bcfd3 Add logging to ResolveAddr 2 years ago
.gx gx publish 0.2.1 2 years ago
ci Create Jenkinsfile (#45) 2 years ago
.travis.yml Update Go in Travis 2 years ago
LICENSE license 6 years ago
Makefile test cross-platform building 3 years ago
README.md Add badges, fix spello, and test unresolvable dials (#68) 2 years ago
addr.go Add logging to ResolveAddr 2 years ago
codecov.yml Update Travis CI to use standard test script. Add basic Makefile. 4 years ago
control_unix.go Fix build on wasm 2 years ago
control_wasm.go Fix build on wasm 2 years ago
control_windows.go windows: use SO_REUSEADDR form sys/windows instead of from syscall (#63) 2 years ago
gitea-test Add gitea test file 2 years ago
go.mod Add go mod turds 2 years ago
go.sum Add go mod turds 2 years ago
interface.go Add badges, fix spello, and test unresolvable dials (#68) 2 years ago
package.json gx: remove old deps 2 years ago
reuse_test.go Add badges, fix spello, and test unresolvable dials (#68) 2 years ago

README.md

go-reuseport

codecov Travis CI

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.