proxyclient

package module
v0.0.0-...-93a6bf1 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2017 License: MIT Imports: 15 Imported by: 0

README

ProxyClient

the proxy client library

supported SOCK4, SOCKS4A, SOCKS5, HTTP, HTTPS etc proxy protocols

Supported Protocols

  • HTTP
  • HTTPS
  • SOCKS4
  • SOCKS4A
  • SOCKS5
  • SOCKS5 with TLS
  • ShadowSocks
  • SSH Agent
  • VMess

Documentation

The full documentation is available on Godoc.

Example

package main

import (
	"fmt"
	"io/ioutil"
	"net/http"
	"github.com/RouterScript/ProxyClient"
)

func main() {
	dial, _ := proxyclient.NewProxyClient("http://localhost:8080")
	client := &http.Client{
		Transport: &http.Transport{
			DialContext: dial.WrappedContext(),
		},
	}
	request, err := client.Get("http://www.example.com")
	if err != nil {
		panic(err)
	}
	content, err := ioutil.ReadAll(request.Body)
	if err != nil {
		panic(err)
	}
	fmt.Println(string(content))
}

Reference

see http://github.com/GameXG/ProxyClient

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterScheme

func RegisterScheme(schemeName string, factory DialBuilder)

func SupportedSchemes

func SupportedSchemes() []string

Types

type Dial

type Dial func(network, address string) (net.Conn, error)

func DialWithTimeout

func DialWithTimeout(timeout time.Duration) Dial

func NewProxyClient

func NewProxyClient(proxy string) (Dial, error)

func NewProxyClientChain

func NewProxyClientChain(proxies ...string) (Dial, error)

func NewProxyClientChainWithDial

func NewProxyClientChainWithDial(proxies []string, upstreamDial Dial) (dial Dial, err error)

func NewProxyClientWithDial

func NewProxyClientWithDial(proxy string, dial Dial) (_ Dial, err error)

func NewSSHAgentProxyClient

func NewSSHAgentProxyClient(proxy *url.URL, upstreamDial Dial) (dial Dial, err error)

func NewShadowsocksProxyClient

func NewShadowsocksProxyClient(proxy *url.URL, upstreamDial Dial) (dial Dial, err error)

func NewSplitPacketProxyClient

func NewSplitPacketProxyClient(_ *url.URL, upstreamDial Dial) (dial Dial, err error)

func (Dial) TCPOnly

func (dial Dial) TCPOnly() Dial

func (Dial) WrappedContext

func (dial Dial) WrappedContext() func(ctx context.Context, network, address string) (net.Conn, error)

type DialBuilder

type DialBuilder func(*url.URL, Dial) (Dial, error)

Jump to

Keyboard shortcuts

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