Skip to content
Snippets Groups Projects
Select Git revision
  • eddb4a7a259f55b8d413d4ff365312f9ca5a4460
  • master default
  • renovate/go-1.x
  • renovate/golang.org-x-sync-0.x
  • renovate/github.com-prometheus-client_golang-1.x
  • renovate/github.com-jhillyerd-enmime-2.x
6 results

browser.go

Blame
  • dialer_legacy.go 581 B
    // +build !go1.9
    
    package clientutil
    
    import (
    	"context"
    	"net"
    	"time"
    )
    
    // Go < 1.9 does not have net.DialContext, reimplement it in terms of
    // net.DialTimeout.
    func netDialContext(addr string, connectTimeout time.Duration) func(context.Context, string, string) (net.Conn, error) {
    	return func(ctx context.Context, net string, _ string) (net.Conn, error) {
    		if deadline, ok := ctx.Deadline(); ok {
    			ctxTimeout := time.Until(deadline)
    			if ctxTimeout < connectTimeout {
    				connectTimeout = ctxTimeout
    			}
    		}
    		return net.DialTimeout(network, addr, connectTimeout)
    	}
    }