本站源代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
832B

  1. // 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. package proxy
  5. import (
  6. "context"
  7. "net"
  8. )
  9. type direct struct{}
  10. // Direct implements Dialer by making network connections directly using net.Dial or net.DialContext.
  11. var Direct = direct{}
  12. var (
  13. _ Dialer = Direct
  14. _ ContextDialer = Direct
  15. )
  16. // Dial directly invokes net.Dial with the supplied parameters.
  17. func (direct) Dial(network, addr string) (net.Conn, error) {
  18. return net.Dial(network, addr)
  19. }
  20. // DialContext instantiates a net.Dialer and invokes its DialContext receiver with the supplied parameters.
  21. func (direct) DialContext(ctx context.Context, network, addr string) (net.Conn, error) {
  22. var d net.Dialer
  23. return d.DialContext(ctx, network, addr)
  24. }
上海开阖软件有限公司 沪ICP备12045867号-1