blob: 3d66bdef9d7493931859e181d22dff1892b8d1ef [file] [log] [blame]
Abhilash S.L3b494632019-07-16 15:51:09 +05301// Copyright 2011 The Go Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style
3// license that can be found in the LICENSE file.
4
5package proxy
6
7import (
8 "context"
9 "net"
10)
11
12type direct struct{}
13
14// Direct implements Dialer by making network connections directly using net.Dial or net.DialContext.
15var Direct = direct{}
16
17var (
18 _ Dialer = Direct
19 _ ContextDialer = Direct
20)
21
22// Dial directly invokes net.Dial with the supplied parameters.
23func (direct) Dial(network, addr string) (net.Conn, error) {
24 return net.Dial(network, addr)
25}
26
27// DialContext instantiates a net.Dialer and invokes its DialContext receiver with the supplied parameters.
28func (direct) DialContext(ctx context.Context, network, addr string) (net.Conn, error) {
29 var d net.Dialer
30 return d.DialContext(ctx, network, addr)
31}