• Audrius Butkevicius's avatar
    net: add ListenConfig, Dialer.Control to permit socket opts before listen/dial · 3c4d3bdd
    Audrius Butkevicius authored
    Existing implementation does not provide a way to set options such as
    SO_REUSEPORT, that has to be set prior the socket being bound.
    
    New exposed API:
    pkg net, method (*ListenConfig) Listen(context.Context, string, string) (Listener, error)
    pkg net, method (*ListenConfig) ListenPacket(context.Context, string, string) (PacketConn, error)
    pkg net, type ListenConfig struct
    pkg net, type ListenConfig struct, Control func(string, string, syscall.RawConn) error
    pkg net, type Dialer struct, Control func(string, string, syscall.RawConn) error
    
    Fixes #9661
    
    Change-Id: If4d275711f823df72d3ac5cc3858651a6a57cccb
    Reviewed-on: https://go-review.googlesource.com/72810
    Run-TryBot: Ian Lance Taylor <iant@golang.org>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
    3c4d3bdd
dial.go 21.3 KB