Closed at15 closed 5 years ago
unix client
func NewPooledUnixTransport(sockFile string) *http.Transport { return &http.Transport{ DialContext: func(ctx context.Context, network, addr string) (net.Conn, error) { d := net.Dialer{ Timeout: 30 * time.Second, KeepAlive: 30 * time.Second, DualStack: true, } return d.DialContext(ctx, "unix", sockFile) }, MaxIdleConns: 100, IdleConnTimeout: 90 * time.Second, TLSHandshakeTimeout: 10 * time.Second, ExpectContinueTimeout: 1 * time.Second, } }
unix server
func ListenAndServeUnix(srv *http.Server, addr string) error { ln, err := net.Listen("unix", addr) if err != nil { return err } // TODO: do we need tcpKeepAliveListener like the default tcp ListenAndServe? return srv.Serve(ln) }
the test is causing race problem in go tip, not sure if the race detector has improved or something else
see https://travis-ci.org/dyweb/gommon/jobs/459629689
fixed in #90
unix client
unix server