tunnel

package
v0.0.0-...-35766b8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 20, 2019 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ClientTransport = &http.Transport{

		DialContext: func(ctx context.Context, network, addr string) (net.Conn, error) {
			pretty.Println(ctx, network, addr)

			tcpAddr, err := net.ResolveTCPAddr(network, "127.0.0.1:8888")
			if err != nil {
				return nil, err
			}
			conn, err := net.DialTCP(network, nil, tcpAddr)
			if err != nil {
				return nil, err
			}

			conn.Write([]byte(
				"CONNECT 127.0.0.1:8889 HTTP/1.1\r\n" +
					"Host: 127.0.0.1:8889\r\n" +
					"Connection: Close\r\n" +
					"\r\n",
			))
			pass(conn)

			conn.Write([]byte(
				"CONNECT " + addr + " HTTP/1.1\r\n" +
					"Host: " + addr + "\r\n" +
					"Connection: Close\r\n" +
					"\r\n",
			))
			pass(conn)

			return conn, nil
		},
		TLSClientConfig: &tls.Config{

			InsecureSkipVerify: true,
		},
	}

	ClientCookieJar, _ = cookiejar.New(
		&cookiejar.Options{

			PublicSuffixList: &jarList{},
		},
	)

	Client = &http.Client{
		Transport: ClientTransport,
		CheckRedirect: func(req *http.Request, via []*http.Request) error {
			if len(via) >= 10 {
				return errors.New("stopped after 10 redirects")
			}
			return nil
		},
		Jar:     ClientCookieJar,
		Timeout: 0,
	}
)

Client for Tunnel

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL