Skip to content

Commit

Permalink
Minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
lilendian0x00 committed Aug 16, 2024
1 parent 301b63d commit d4c0bf7
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
8 changes: 7 additions & 1 deletion xray/protocols.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
14 changes: 10 additions & 4 deletions xray/vmess.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -107,17 +109,21 @@ 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)
}

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
Expand Down

0 comments on commit d4c0bf7

Please sign in to comment.