Skip to content

Commit

Permalink
fix a vmessh2bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Sansui233 committed Nov 25, 2020
1 parent d4213fa commit 85483cf
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
3 changes: 3 additions & 0 deletions README_NEW.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ TODO

## New

2020-11-26
- 修复了一个导致vmess h2解析错误的bug= =

2020-11-25
- 增加tg channel文件的抓取

Expand Down
13 changes: 7 additions & 6 deletions pkg/proxy/vmess.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ type HTTPOptions struct {
}

type HTTP2Options struct {
Host []string `yaml:"host,omitempty" json:"method,omitempty"`
Host []string `yaml:"host,omitempty" json:"host,omitempty"`
Path string `yaml:"path,omitempty" json:"path,omitempty"` // 暂只处理一个Path
}

Expand Down Expand Up @@ -185,22 +185,23 @@ func ParseVmessLink(link string) (*Vmess, error) {

// Transmission protocol
wsHeaders := make(map[string]string)
h2Opt := HTTP2Options{}
h2Opt := HTTP2Options{
Host: make([]string, 0),
}
httpOpt := HTTPOptions{}

// Network <- obfs=websocket
obfs := moreInfo.Get("obfs")
network := "tcp"
if obfs == "http" {
httpOpt.Method = "GET" // 不知道Headers为空时会不会报错
}
// obfs=websocket
if obfs == "websocket" {
network = "ws"
} else { // when http h2
network = obfs
}

// obfsParam=www.036452916.xyz
// HTTP Object: Host <- obfsParam=www.036452916.xyz
host := moreInfo.Get("obfsParam")
if host != "" {
switch obfs {
Expand All @@ -210,7 +211,7 @@ func ParseVmessLink(link string) (*Vmess, error) {
h2Opt.Host = append(h2Opt.Host, host)
}
}

// HTTP Object: Path
path := moreInfo.Get("path")
if path == "" {
path = "/"
Expand Down

0 comments on commit 85483cf

Please sign in to comment.