singproxy

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2026 License: MIT Imports: 30 Imported by: 0

README

singproxy

Go library for dialing through many proxy URL schemes (VLESS, Trojan, VMess, …), built on sing-box.

Module: github.com/ariadata/singproxy

Install

go get github.com/ariadata/singproxy@v1.0.0
import "github.com/ariadata/singproxy"

proxy, err := singproxy.FromURL(timeout, proxyURL)
Build tags
-tags=with_utls,with_quic,with_wireguard

Offline vendor

This repo commits vendor/ for offline-friendly builds:

make vendor   # needs network
make build    # -mod=vendor
make test

Basic usage

package main

import (
	"fmt"
	"time"

	"github.com/ariadata/singproxy"
)

func main() {
	proxy, err := singproxy.FromURL(8*time.Second, "vless://…")
	if err != nil {
		panic(err)
	}
	fmt.Println(proxy.String())
}

Release

git tag -a v1.0.0 -m "v1.0.0"
git push origin main --tags

License

MIT — free to use, modify, and distribute.

Credits

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidProxyFormat      = errors.New("invalid proxy format")
	ErrUnsupportedScheme       = errors.New("unsupported proxy scheme")
	ErrMissingTarget           = errors.New("missing target")
	ErrProxyDialTimeoutReached = &net.OpError{
		Op:  "dial",
		Net: "proxy dial timeout",
		Err: errors.New("proxy dial timed out"),
	}
)

Functions

This section is empty.

Types

type Proxy

type Proxy interface {
	String() string
	Addr() net.IP
	DialContext(ctx context.Context, network string, addr *net.TCPAddr) (net.Conn, error)
}
var Direct Proxy = &directProxy{}

func FromURL

func FromURL(timeout time.Duration, proxyURL string) (Proxy, error)

func FromURLs

func FromURLs(timeout time.Duration, urls ...string) ([]Proxy, []error)

type SingBoxProxy

type SingBoxProxy struct {
	// contains filtered or unexported fields
}

func (*SingBoxProxy) Addr

func (p *SingBoxProxy) Addr() net.IP

func (*SingBoxProxy) DialContext

func (p *SingBoxProxy) DialContext(ctx context.Context, network string, addr *net.TCPAddr) (net.Conn, error)

func (*SingBoxProxy) String

func (p *SingBoxProxy) String() string

Jump to

Keyboard shortcuts

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