configAdapter

package
v1.2.5 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2022 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

package configAdapter provides methods to convert proxy.ListenConf and proxy.DialConf to some 3rd party formats.

对于第三方工具的配置, 支持 quantumultX, clash, 以及 v2rayN 的配置格式

参考 https://github.com/e1732a364fed/v2ray_simple/discussions/163

以及 docs/url.md

本包依然秉持KISS原则,用最笨的代码、最少的依赖,实现最小的可执行文件大小以及最快的执行速度。

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractQxRemoteServers added in v1.2.5

func ExtractQxRemoteServers(configContentStr string)

func FromQX added in v1.2.5

func FromQX(str string) (dc proxy.DialConf)

func ToClash

func ToClash(dc *proxy.DialConf) string
clash使用yaml作为配置格式。本函数中不导出整个yaml配置文件,而只导出

对应的proxies项下的子项,比如

  • name: "ss1" type: ss server: server port: 443 cipher: chacha20-ietf-poly1305 password: "password"

See https://github.com/Dreamacro/clash/wiki/Configuration

clash的配置对于不同的协议来说,格式也有不同,clash基本上尊重了每一个协议的约定, 但也不完全一致

func ToQX

func ToQX(dc *proxy.DialConf) string

To Quantumult X [server_local] string

quantumult X 只支持 vmess,trojan,shadowsocks,http 这四种协议. See https://github.com/crossutility/Quantumult-X/blob/master/sample.conf

圈叉的配置,每一个协议的格式都略有不同,我们只能照着示例分情况处理。

同时,我们不支持里面的 fast-open 等选项。

func ToSS

func ToSS(cc *proxy.CommonConf, lc *proxy.ListenConf, plain_userinfo bool, sip int) string

Generate shadowsocks's official uri based on proxy.CommonConf and other parameters.

See https://github.com/shadowsocks/shadowsocks-org/wiki/SIP002-URI-Scheme 若lc给出,则表示用于服务端. sip 用于指定协议标准,可以设为4 或者22. 4 表示 sip004, Aead; 22表示 sip022, 即aead-2022

func ToXray

func ToXray(dc *proxy.DialConf) string

Generate xray url draft based on proxy.DialConf. See https://github.com/XTLS/Xray-core/discussions/716

Types

type V2rayNConfig

type V2rayNConfig struct {
	V        string `json:"v"`   //配置文件版本号,主要用来识别当前配置
	PS       string `json:"ps"`  //备注或别名
	Add      string `json:"add"` //地址IP或域名
	Port     string `json:"port"`
	ID       string `json:"id"`
	Security string `json:"scy"`
	Net      string `json:"net"`  //(tcp\kcp\ws\h2\quic)
	Type     string `json:"type"` //(none\http\srtp\utp\wechat-video) *tcp or kcp or QUIC
	Host     string `json:"host"`
	Path     string `json:"path"`
	Tls      string `json:"tls"`
	Sni      string `json:"sni"`
}

Directories

Path Synopsis
Package v2ray_v5 supports v2ray v5 config and convertion methods between vs standard toml config format See https://www.v2fly.org/v5/config/
Package v2ray_v5 supports v2ray v5 config and convertion methods between vs standard toml config format See https://www.v2fly.org/v5/config/

Jump to

Keyboard shortcuts

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