From d4c0bf78a459a1636a825dacfd1d16e6693ec2cb Mon Sep 17 00:00:00 2001 From: lilendian0x00 Date: Fri, 16 Aug 2024 20:58:59 +0100 Subject: [PATCH] Minor changes --- xray/protocols.go | 8 +++++++- xray/vmess.go | 14 ++++++++++---- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/xray/protocols.go b/xray/protocols.go index ecfb66d..349ae72 100644 --- a/xray/protocols.go +++ b/xray/protocols.go @@ -80,7 +80,13 @@ type Vmess struct { ALPN string `json:"alpn"` // Application-Layer Protocol Negotiation TlsFingerprint string `json:"fp"` // TLS fingerprint Type string `json:"type"` // Used for HTTP Obfuscation - OrigLink string `json:"-"` // Original link + + //// It's also possible for Vmess to have REALITY... + //PublicKey string `json:"pbk"` + //ShortIds string `json:"sid"` // Mandatory, the shortId list available to the client, which can be used to distinguish different clients + //SpiderX string `json:"spx"` // Reality path + + OrigLink string `json:"-"` // Original link } type Vless struct { diff --git a/xray/vmess.go b/xray/vmess.go index fb63eb7..ba20fe1 100644 --- a/xray/vmess.go +++ b/xray/vmess.go @@ -36,6 +36,8 @@ func method1(v *Vmess, link string) error { return nil } +// Example: +// vmess://YXV0bzpjYmI0OTM1OC00NGQxLTQ4MmYtYWExNC02ODA3NzNlNWNjMzdAc25hcHBmb29kLmlyOjQ0Mw?remarks=sth&obfsParam=huhierg.com&path=/&obfs=websocket&tls=1&peer=gdfgreg.com&alterId=0 func method2(v *Vmess, link string) error { uri, err := url.Parse(link) if err != nil { @@ -107,6 +109,10 @@ func method2(v *Vmess, link string) error { return nil } +//func method3(v *Vmess, link string) error { +// +//} + func (v *Vmess) Parse(configLink string) error { if !strings.HasPrefix(configLink, vmessIdentifier) { return fmt.Errorf("vmess unreconized: %s", configLink) @@ -114,10 +120,10 @@ func (v *Vmess) Parse(configLink string) error { var err error = nil - if err = method1(v, configLink); err == nil { - - } else if err = method2(v, configLink); err == nil { - + if err = method1(v, configLink); err != nil { + if err = method2(v, configLink); err != nil { + return err + } } v.OrigLink = configLink