Source File
options.go
Belonging Package
github.com/libp2p/go-libp2p/p2p/transport/quicreuse
package quicreuseimport ()type Option func(*ConnManager) errortype listenUDP func(network string, laddr *net.UDPAddr) (net.PacketConn, error)func ( listenUDP) Option {return func( *ConnManager) error {.listenUDP =return nil}}func ( func() (SourceIPSelector, error)) Option {return func( *ConnManager) error {.sourceIPSelectorFn =return nil}}func () Option {return func( *ConnManager) error {.enableReuseport = falsereturn nil}}// ConnContext sets the context for all connections accepted by listeners. This doesn't affect the// context for dialed connections. To reject a connection, return a non nil error.func ( func( context.Context, *quic.ClientInfo) (context.Context, error)) Option {return func( *ConnManager) error {if .connContext != nil {return errors.New("cannot set ConnContext more than once")}.connContext =return nil}}// VerifySourceAddress returns whether to verify the source address for incoming connection requests.// For more details see: `quic.Transport.VerifySourceAddress`func ( func( net.Addr) bool) Option {return func( *ConnManager) error {.verifySourceAddress =return nil}}// EnableMetrics enables Prometheus metrics collection. If reg is nil,// prometheus.DefaultRegisterer will be used as the registerer.func ( prometheus.Registerer) Option {return func( *ConnManager) error {.enableMetrics = trueif != nil {.registerer =}return nil}}
![]() |
The pages are generated with Golds v0.8.2. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |