Help us shape the future of Go! Take the 2026 Go Developer Survey

proxit

package module
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2025 License: LGPL-3.0 Imports: 17 Imported by: 0

README

Supported

  • HTTP
  • HTTPS
  • SOCKS4
  • SOCKS4A
  • SOCKS5
  • SSH
  • ShadowSocks
  • VMess

Example

package main

import (
	"fmt"
	"github.com/dneht/proxit"
	"io"
	"net/http"
)

func main() {
	proxy, err := proxit.New("shadowsocks://method:password@localhost:2222")
	if err != nil {
		panic(err)
	}
	client := &http.Client{
		Transport: &http.Transport{
			DialContext: proxy.DialContext,
		},
	}
	request, err := client.Get("https://httpbin.org/get")
	if err != nil {
		panic(err)
	}
	content, err := io.ReadAll(request.Body)
	if err != nil {
		panic(err)
	}
	fmt.Println(string(content))
}

Documentation

Index

Constants

View Source
const (
	SchemeHTTP        = "http"
	SchemeHTTPS       = "https"
	SchemeSocks       = "socks"
	SchemeSocks4      = "socks4"
	SchemeSocks4a     = "socks4a"
	SchemeSocks5      = "socks5"
	SchemeSSH         = "ssh"
	SchemeShadowsocks = "shadowsocks"
	SchemeVMess       = "vmess"
	SchemeVLESS       = "vless"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option struct {
	Context context.Context
	Dialer  N.Dialer
	Logger  L.Logger
}

type Proxy

type Proxy interface {
	DialContext(ctx context.Context, network, addr string) (net.Conn, error)
}

func New

func New(input string) (Proxy, error)

func NewHTTP

func NewHTTP(url *url.URL, option *Option) Proxy

func NewSSH

func NewSSH(url *url.URL, option *Option) (Proxy, error)

func NewShadowsocks

func NewShadowsocks(url *url.URL, option *Option) (Proxy, error)

func NewSocks

func NewSocks(url *url.URL, option *Option) Proxy

func NewVLess

func NewVLess(url *url.URL, option *Option) (Proxy, error)

func NewVmess

func NewVmess(url *url.URL, option *Option) (Proxy, error)

func NewWithOption

func NewWithOption(input string, option *Option) (Proxy, error)

Jump to

Keyboard shortcuts

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