the additional HTTP2 proxies are considered as HTTPS proxies
This commit is contained in:
parent
124bfc42ea
commit
c3072d4ed0
@ -147,7 +147,7 @@ gost的HTTP2支持两种模式并自适应:
|
|||||||
* 作为标准的HTTP2代理,并向下兼容HTTPS代理。
|
* 作为标准的HTTP2代理,并向下兼容HTTPS代理。
|
||||||
* 作为transport(类似于wss),传输其他协议。
|
* 作为transport(类似于wss),传输其他协议。
|
||||||
|
|
||||||
**注:gost的代理链仅支持一个HTTP2代理节点,采用就近原则,会将第一个遇到的HTTP2代理节点视为HTTP2代理,其他HTTP2代理节点则被视为HTTP代理。**
|
**注:gost的代理链仅支持一个HTTP2代理节点,采用就近原则,会将第一个遇到的HTTP2代理节点视为HTTP2代理,其他HTTP2代理节点则被视为HTTPS代理。**
|
||||||
|
|
||||||
加密机制
|
加密机制
|
||||||
------
|
------
|
||||||
|
3
chain.go
3
chain.go
@ -140,6 +140,9 @@ func (c *ProxyChain) GetConn() (net.Conn, error) {
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
http2Node := c.nodes[c.http2NodeIndex]
|
http2Node := c.nodes[c.http2NodeIndex]
|
||||||
|
if http2Node.Transport == "http2" {
|
||||||
|
http2Node.Transport = "h2"
|
||||||
|
}
|
||||||
if http2Node.Protocol == "http2" {
|
if http2Node.Protocol == "http2" {
|
||||||
http2Node.Protocol = "socks5" // assume it as socks5 protocol, so we can do much more things.
|
http2Node.Protocol = "socks5" // assume it as socks5 protocol, so we can do much more things.
|
||||||
}
|
}
|
||||||
|
4
conn.go
4
conn.go
@ -73,14 +73,14 @@ func (c *ProxyConn) handshake() error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
c.conn = conn
|
c.conn = conn
|
||||||
case "tls": // tls connection
|
case "tls", "http2": // tls connection
|
||||||
tlsUsed = true
|
tlsUsed = true
|
||||||
cfg := &tls.Config{
|
cfg := &tls.Config{
|
||||||
InsecureSkipVerify: c.Node.insecureSkipVerify(),
|
InsecureSkipVerify: c.Node.insecureSkipVerify(),
|
||||||
ServerName: c.Node.serverName,
|
ServerName: c.Node.serverName,
|
||||||
}
|
}
|
||||||
c.conn = tls.Client(c.conn, cfg)
|
c.conn = tls.Client(c.conn, cfg)
|
||||||
case "http2":
|
case "h2": // same as http2, but just set a flag for later using.
|
||||||
tlsUsed = true
|
tlsUsed = true
|
||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
|
5
node.go
5
node.go
@ -1,6 +1,7 @@
|
|||||||
package gost
|
package gost
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"net"
|
"net"
|
||||||
"net/url"
|
"net/url"
|
||||||
"strconv"
|
"strconv"
|
||||||
@ -112,3 +113,7 @@ func (node *ProxyNode) keyFile() string {
|
|||||||
}
|
}
|
||||||
return DefaultKeyFile
|
return DefaultKeyFile
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (node ProxyNode) String() string {
|
||||||
|
return fmt.Sprintf("transport: %s, protocol: %s, addr: %s", node.Transport, node.Protocol, node.Addr)
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user