Changeset 732 in code for trunk/user.go


Ignore:
Timestamp:
Dec 2, 2021, 9:53:43 AM (4 years ago)
Author:
contact
Message:

Add context to connectToUpstream

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/user.go

    r731 r732  
    203203                lastTry = time.Now()
    204204
    205                 uc, err := connectToUpstream(net)
     205                uc, err := connectToUpstream(context.TODO(), net)
    206206                if err != nil {
    207207                        net.logger.Printf("failed to connect to upstream server %q: %v", net.Addr, err)
     
    10161016// localAddrForHost returns the local address to use when connecting to host.
    10171017// A nil address is returned when the OS should automatically pick one.
    1018 func (u *user) localTCPAddrForHost(host string) (*net.TCPAddr, error) {
     1018func (u *user) localTCPAddrForHost(ctx context.Context, host string) (*net.TCPAddr, error) {
    10191019        upstreamUserIPs := u.srv.Config().UpstreamUserIPs
    10201020        if len(upstreamUserIPs) == 0 {
     
    10221022        }
    10231023
    1024         ips, err := net.LookupIP(host)
     1024        ips, err := net.DefaultResolver.LookupIP(ctx, "ip", host)
    10251025        if err != nil {
    10261026                return nil, err
Note: See TracChangeset for help on using the changeset viewer.