Skip to content
This repository has been archived by the owner on May 26, 2022. It is now read-only.

Commit

Permalink
improve package-level documentation (#43)
Browse files Browse the repository at this point in the history
  • Loading branch information
marten-seemann authored May 20, 2022
1 parent 12f6bdd commit 36e5092
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions transport.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
// 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.
package tcpreuse

import (
Expand All @@ -13,6 +22,7 @@ var log = logging.Logger("reuseport-transport")
var ErrWrongProto = errors.New("can only dial TCP over IPv4 or IPv6")

// Transport is a TCP reuse transport that reuses listener ports.
// The zero value is safe to use.
type Transport struct {
v4 network
v6 network
Expand Down

0 comments on commit 36e5092

Please sign in to comment.