nodep

package
v1.8.6 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PingDelayTimeout int64 = 11000
	PingDelayError   int64 = 10000
)

Variables

This section is empty.

Functions

func ConvertShareTextToXrayJson

func ConvertShareTextToXrayJson(textPath string, xrayPath string) string

Convert share text to XrayJson support XrayJson, v2rayN plain text, v2rayN base64 text, Clash yaml, Clash.Meta yaml

func ConvertXrayJsonToShareText

func ConvertXrayJsonToShareText(xrayPath string, textPath string) string

Convert XrayJson to share links. VMess will generate VMessAEAD link.

func GetFreePorts

func GetFreePorts(count int) string

https://github.com/phayes/freeport/blob/master/freeport.go GetFreePort asks the kernel for free open ports that are ready to use.

func InitForceFree

func InitForceFree(maxMemory int64, interval int)

func MeasureDelay

func MeasureDelay(timeout int, url string, times int, proxy string) (int64, string, error)

func TcpPing

func TcpPing(timeout int, server string, times int) string

Find the delay of some outbound. timeout means how long the tcp connection will be cancelled if no response, in units of seconds. server means the destination we use to test speed, like "8.8.8.8:853". times means how many times we should test the server.

func WriteBytes

func WriteBytes(bytes []byte, path string) error

func WriteText

func WriteText(text string, path string) error

Types

type ClashProxy

type ClashProxy struct {
	Name     string `yaml:"name,omitempty"`
	Type     string `yaml:"type,omitempty"`
	Server   string `yaml:"server,omitempty"`
	Port     int    `yaml:"port,omitempty"`
	Uuid     string `yaml:"uuid,omitempty"`
	Cipher   string `yaml:"cipher,omitempty"`
	Username string `yaml:"username,omitempty"`
	Password string `yaml:"password,omitempty"`

	Tls            bool     `yaml:"tls,omitempty"`
	SkipCertVerify bool     `yaml:"skip-cert-verify,omitempty"`
	Servername     string   `yaml:"servername,omitempty"`
	Sni            string   `yaml:"sni,omitempty"`
	Alpn           []string `yaml:"alpn,omitempty"`

	Fingerprint       string                 `yaml:"fingerprint,omitempty"`
	ClientFingerprint string                 `yaml:"client-fingerprint,omitempty"`
	Flow              string                 `yaml:"flow,omitempty"`
	RealityOpts       *ClashProxyRealityOpts `yaml:"reality-opts,omitempty"`

	Network    string                `yaml:"network,omitempty"`
	Plugin     string                `yaml:"plugin,omitempty"`
	PluginOpts *ClashProxyPluginOpts `yaml:"plugin-opts,omitempty"`
	WsOpts     *ClashProxyWsOpts     `yaml:"ws-opts,omitempty"`
	H2Opts     *ClashProxyH2Opts     `yaml:"h2-opts,omitempty"`
	GrpcOpts   *ClashProxyGrpcOpts   `yaml:"grpc-opts,omitempty"`
}

type ClashProxyGrpcOpts

type ClashProxyGrpcOpts struct {
	GrpcServiceName string `yaml:"grpc-service-name,omitempty"`
}

type ClashProxyH2Opts

type ClashProxyH2Opts struct {
	Host []string `yaml:"host,omitempty"`
	Path string   `yaml:"path,omitempty"`
}

type ClashProxyPluginOpts

type ClashProxyPluginOpts struct {
	Mode           string `yaml:"mode,omitempty"`
	Tls            bool   `yaml:"tls,omitempty"`
	Fingerprint    string `yaml:"fingerprint,omitempty"`
	SkipCertVerify bool   `yaml:"skip-cert-verify,omitempty"`
	Host           string `yaml:"host,omitempty"`
	Path           string `yaml:"path,omitempty"`
}

type ClashProxyRealityOpts

type ClashProxyRealityOpts struct {
	PublicKey string `yaml:"public-key,omitempty"`
	ShortId   string `yaml:"short-id,omitempty"`
}

type ClashProxyWsOpts

type ClashProxyWsOpts struct {
	Path                string                   `yaml:"path,omitempty"`
	Headers             *ClashProxyWsOptsHeaders `yaml:"headers,omitempty"`
	MaxEarlyData        int                      `yaml:"max-early-data,omitempty"`
	EarlyDataHeaderName string                   `yaml:"early-data-header-name,omitempty"`
}

type ClashProxyWsOptsHeaders

type ClashProxyWsOptsHeaders struct {
	Host string `yaml:"Host,omitempty"`
}

type ClashYaml

type ClashYaml struct {
	Proxies []ClashProxy `yaml:"proxies,omitempty"`
}

type XrayFakeHeader

type XrayFakeHeader struct {
	Type string `json:"type,omitempty"`
}

type XrayGrpcSettings

type XrayGrpcSettings struct {
	ServiceName string `json:"serviceName,omitempty"`
	MultiMode   bool   `json:"multiMode,omitempty"`
}

type XrayHttpSettings

type XrayHttpSettings struct {
	Host []string `json:"host,omitempty"`
	Path string   `json:"path,omitempty"`
}

type XrayJson

type XrayJson struct {
	Outbounds []XrayOutbound `json:"outbounds,omitempty"`
}

func (XrayJson) FlattenOutbounds

func (xray XrayJson) FlattenOutbounds() []XrayOutbound

type XrayKcpSettings

type XrayKcpSettings struct {
	Header *XrayFakeHeader `json:"header,omitempty"`
	Seed   string          `json:"seed,omitempty"`
}

type XrayOutbound

type XrayOutbound struct {
	Name           string              `json:"name,omitempty"`
	Protocol       string              `json:"protocol,omitempty"`
	Settings       *json.RawMessage    `json:"settings,omitempty"`
	StreamSettings *XrayStreamSettings `json:"streamSettings,omitempty"`
}

Keep same with Xray Config, but add name for sharing.

func (proxy XrayOutbound) ShareLink() (*url.URL, error)

type XrayQuicSettings

type XrayQuicSettings struct {
	Security string          `json:"security,omitempty"`
	Key      string          `json:"key,omitempty"`
	Header   *XrayFakeHeader `json:"header,omitempty"`
}

type XrayRealitySettings

type XrayRealitySettings struct {
	Fingerprint string `json:"fingerprint,omitempty"`
	ServerName  string `json:"serverName,omitempty"`
	PublicKey   string `json:"publicKey,omitempty"`
	ShortId     string `json:"shortId,omitempty"`
	SpiderX     string `json:"spiderX,omitempty"`
}

type XrayShadowsocks

type XrayShadowsocks struct {
	Servers []XrayShadowsocksServer `json:"servers,omitempty"`
}

type XrayShadowsocksServer

type XrayShadowsocksServer struct {
	Address  string `json:"address,omitempty"`
	Port     int    `json:"port,omitempty"`
	Method   string `json:"method,omitempty"`
	Password string `json:"password,omitempty"`
}

type XraySocks

type XraySocks struct {
	Servers []XraySocksServer `json:"servers,omitempty"`
}

type XraySocksServer

type XraySocksServer struct {
	Address string                `json:"address,omitempty"`
	Port    int                   `json:"port,omitempty"`
	Users   []XraySocksServerUser `json:"users,omitempty"`
}

type XraySocksServerUser

type XraySocksServerUser struct {
	User string `json:"user,omitempty"`
	Pass string `json:"pass,omitempty"`
}

type XrayStreamSettings

type XrayStreamSettings struct {
	Network         string               `json:"network,omitempty"`
	Security        string               `json:"security,omitempty"`
	TlsSettings     *XrayTlsSettings     `json:"tlsSettings,omitempty"`
	RealitySettings *XrayRealitySettings `json:"realitySettings,omitempty"`
	TcpSettings     *XrayTcpSettings     `json:"tcpSettings,omitempty"`
	KcpSettings     *XrayKcpSettings     `json:"kcpSettings,omitempty"`
	WsSettings      *XrayWsSettings      `json:"wsSettings,omitempty"`
	HttpSettings    *XrayHttpSettings    `json:"httpSettings,omitempty"`
	QuicSettings    *XrayQuicSettings    `json:"quicSettings,omitempty"`
	GrpcSettings    *XrayGrpcSettings    `json:"grpcSettings,omitempty"`
}

type XrayTcpSettings

type XrayTcpSettings struct {
	Header *XrayTcpSettingsHeader `json:"header,omitempty"`
}

type XrayTcpSettingsHeader

type XrayTcpSettingsHeader struct {
	Type    string                        `json:"type,omitempty"`
	Request *XrayTcpSettingsHeaderRequest `json:"request,omitempty"`
}

type XrayTcpSettingsHeaderRequest

type XrayTcpSettingsHeaderRequest struct {
	Path    []string                             `json:"path,omitempty"`
	Headers *XrayTcpSettingsHeaderRequestHeaders `json:"headers,omitempty"`
}

type XrayTcpSettingsHeaderRequestHeaders

type XrayTcpSettingsHeaderRequestHeaders struct {
	Host []string `json:"Host,omitempty"`
}

type XrayTlsSettings

type XrayTlsSettings struct {
	ServerName    string   `json:"serverName,omitempty"`
	AllowInsecure bool     `json:"allowInsecure,omitempty"`
	Alpn          []string `json:"alpn,omitempty"`
	Fingerprint   string   `json:"fingerprint,omitempty"`
}

type XrayTrojan

type XrayTrojan struct {
	Servers []XrayTrojanServer `json:"servers,omitempty"`
}

type XrayTrojanServer

type XrayTrojanServer struct {
	Address  string `json:"address,omitempty"`
	Port     int    `json:"port,omitempty"`
	Password string `json:"password,omitempty"`
}

type XrayVLESS

type XrayVLESS struct {
	Vnext []XrayVLESSVnext `json:"vnext,omitempty"`
}

type XrayVLESSVnext

type XrayVLESSVnext struct {
	Address string               `json:"address,omitempty"`
	Port    int                  `json:"port,omitempty"`
	Users   []XrayVLESSVnextUser `json:"users,omitempty"`
}

type XrayVLESSVnextUser

type XrayVLESSVnextUser struct {
	Id   string `json:"id,omitempty"`
	Flow string `json:"flow,omitempty"`
}

type XrayVMess

type XrayVMess struct {
	Vnext []XrayVMessVnext `json:"vnext,omitempty"`
}

type XrayVMessVnext

type XrayVMessVnext struct {
	Address string               `json:"address,omitempty"`
	Port    int                  `json:"port,omitempty"`
	Users   []XrayVMessVnextUser `json:"users,omitempty"`
}

type XrayVMessVnextUser

type XrayVMessVnextUser struct {
	Id       string `json:"id,omitempty"`
	Security string `json:"security,omitempty"`
}

type XrayWsSettings

type XrayWsSettings struct {
	Path    string                 `json:"path,omitempty"`
	Headers *XrayWsSettingsHeaders `json:"headers,omitempty"`
}

type XrayWsSettingsHeaders

type XrayWsSettingsHeaders struct {
	Host string `json:"Host,omitempty"`
}

Jump to

Keyboard shortcuts

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