tcpreuse

package module
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 25, 2022 License: MIT Imports: 1 Imported by: 2

README

DEPRECATION NOTICE

This package has moved into go-libp2p as a sub-package, github.com/libp2p/go-libp2p/p2p/net/reuseport.

go-reuseport-transport

Discourse posts GoDoc Build Status

Basic reuseport TCP transport

This package provides a basic transport for automatically (and intelligently) reusing TCP ports.

To use, construct a new Transport (the zero value is safe to use) and configure any listeners (tr.Listen(...)).

Then, when dialing (tr.Dial(...)), the transport will attempt to reuse the ports it's currently listening on, choosing the best one depending on the destination address.

NOTE: Currently, we don't make any attempts to prevent two reusport transports from interfering with each other (reusing each other's ports). However, we reserve the right to fix this in the future.

Install

go-reuseport-transport is a standard Go module which can be installed with:

go get github.com/libp2p/go-reuseport-transport

Current use in libp2p

This package is currently used by the go-tcp-transport libp2p transport and will likely be used by more libp2p transports in the future.

Contribute

Feel free to join in. All welcome. Open an issue!

This repository falls under the libp2p Code of Conduct.

Want to hack on libp2p?

License

MIT


The last gx published version of this module was: 0.2.3: QmTmbamDjDWgHe8qeMt7ZpaeNpTj349JpFKuwTF321XavT

Documentation

Overview

Package tcpreuse provides a basic transport for automatically (and intelligently) reusing TCP ports.

To use, construct a new Transport and configure listeners tr.Listen(...). When dialing (tr.Dial(...)), the transport will attempt to reuse the ports it's currently listening on, choosing the best one depending on the destination address.

It is recommended to set set SO_LINGER to 0 for all connections, otherwise reusing the port may fail when re-dialing a recently closed connection. See https://hea-www.harvard.edu/~fine/Tech/addrinuse.html for details.

Deprecated: This package has moved into go-libp2p as a sub-package: github.com/libp2p/go-libp2p/p2p/net/reuseport.

Index

Constants

This section is empty.

Variables

View Source
var ErrWrongProto = reuseport.ErrWrongProto

ErrWrongProto is returned when dialing a protocol other than tcp. Deprecated: use github.com/libp2p/go-libp2p/p2p/net/reuseport.ErrWrongProto instead.

Functions

This section is empty.

Types

type Transport

type Transport = reuseport.Transport

Transport is a TCP reuse transport that reuses listener ports. The zero value is safe to use. Deprecated: use github.com/libp2p/go-libp2p/p2p/net/reuseport.Transport instead.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL