link

package
v0.0.0-...-890cd7e Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2023 License: GPL-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotImplemented = E.New("not implemented")
)

errors

Functions

func RegisterParser

func RegisterParser(parser *Parser) error

RegisterParser add a new link parser.

Types

type Link interface {
	// URL returns the url representation of the link
	URL() (string, error)
	// Outbound returns equivalent outbound options of the link
	Outbound() (*option.Outbound, error)
}

Link is the interface for links

func Parse

func Parse(u *url.URL) (Link, error)

Parse parses a link string to Link

func ParseCollection

func ParseCollection(content string) ([]Link, error)

ParseCollection parses a links collection string to []Link

type ParseFunc

type ParseFunc func(u *url.URL) (Link, error)

ParseFunc is the parser function to parse links, like "vmess://..."

type Parser

type Parser struct {
	Name   string
	Scheme []string
	Parse  ParseFunc
}

Parser is the links parser for specified schemes

type ShadowSocks

type ShadowSocks struct {
	Method     string `json:"method,omitempty"`
	Password   string `json:"password,omitempty"`
	Address    string `json:"address,omitempty"`
	Port       uint16 `json:"port,omitempty"`
	Ps         string `json:"ps,omitempty"`
	Plugin     string `json:"plugin,omitempty"`
	PluginOpts string `json:"plugin-opts,omitempty"`
}

ShadowSocks represents a parsed shadowsocks link

func ParseShadowSocks

func ParseShadowSocks(u *url.URL) (*ShadowSocks, error)

ParseShadowSocks parses a shadowsocks link

https://github.com/shadowsocks/shadowsocks-org/wiki/SIP002-URI-Scheme

func (*ShadowSocks) Outbound

func (l *ShadowSocks) Outbound() (*option.Outbound, error)

Outbound implements Link

func (*ShadowSocks) URL

func (l *ShadowSocks) URL() (string, error)

URL implements Link

type TrojanQt5

type TrojanQt5 struct {
	Remarks       string
	Address       string
	Port          uint16
	Password      string
	AllowInsecure bool
	TFO           bool
}

TrojanQt5 represents a parsed Trojan-Qt5 link

func ParseTrojanQt5

func ParseTrojanQt5(u *url.URL) (*TrojanQt5, error)

ParseTrojanQt5 parses a Trojan-Qt5 link

trojan://password@domain:port?allowinsecure=value&tfo=value#remarks

func (*TrojanQt5) Outbound

func (l *TrojanQt5) Outbound() (*option.Outbound, error)

Outbound implements Link

func (*TrojanQt5) URL

func (l *TrojanQt5) URL() (string, error)

URL implements Link

type VMessQuantumult

type VMessQuantumult struct {
	Vmess
}

VMessQuantumult is the vmess link of Quantumult

func ParseVMessQuantumult

func ParseVMessQuantumult(u *url.URL) (*VMessQuantumult, error)

ParseVMessQuantumult parses a Quantumult vmess link

type VMessRocket

type VMessRocket struct {
	Vmess
}

VMessRocket is the vmess link of ShadowRocket

func ParseVMessRocket

func ParseVMessRocket(u *url.URL) (*VMessRocket, error)

ParseVMessRocket parses a ShadowRocket vmess link

func (*VMessRocket) URL

func (v *VMessRocket) URL() (string, error)

URL implements Link

type VMessV2RayNG

type VMessV2RayNG struct {
	Vmess
}

VMessV2RayNG is the vmess link of V2RayNG

func ParseVMessV2RayNG

func ParseVMessV2RayNG(u *url.URL) (*VMessV2RayNG, error)

ParseVMessV2RayNG parses vmess link of V2RayNG

func (*VMessV2RayNG) URL

func (l *VMessV2RayNG) URL() (string, error)

URL implements Link

type Vmess

type Vmess struct {
	Tag        string
	Server     string
	ServerPort uint16
	UUID       string
	AlterID    int
	Security   string

	Transport     string
	TransportHost string
	TransportPath string

	TLS              bool
	SNI              string
	ALPN             []string
	TLSAllowInsecure bool
	Fingerprint      string
}

Vmess is the base struct of vmess link

func (*Vmess) Outbound

func (v *Vmess) Outbound() (*option.Outbound, error)

Outbound implements Link

func (*Vmess) URL

func (v *Vmess) URL() (string, error)

URL implements Link

func (*Vmess) URLQuantumult

func (v *Vmess) URLQuantumult() (string, error)

URLQuantumult returns the quantumultx url representation of vmess link

func (*Vmess) URLShadowRocket

func (v *Vmess) URLShadowRocket() (string, error)

URLShadowRocket returns the shadowrocket url representation of vmess link

func (*Vmess) URLV2RayNG

func (v *Vmess) URLV2RayNG() (string, error)

URLV2RayNG returns the shadowrocket url representation of vmess link

Jump to

Keyboard shortcuts

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