Skip to content

Commit

Permalink
fix tls fingerprint
Browse files Browse the repository at this point in the history
  • Loading branch information
p4gefau1t committed May 15, 2020
1 parent c0b9c1c commit 2e9f8ab
Show file tree
Hide file tree
Showing 5 changed files with 319 additions and 101 deletions.
1 change: 1 addition & 0 deletions conf/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,7 @@ func ParseJSON(data []byte) (*GlobalConfig, error) {
VerifyHostname: true,
SessionTicket: true,
ReuseSession: true,
Fingerprint: "firefox",
},
Mux: MuxConfig{
IdleTimeout: 60,
Expand Down
5 changes: 1 addition & 4 deletions docs/content/basic/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,16 +99,13 @@ sudo ./trojan-go -autocert renew
"your_awesome_password"
],
"ssl": {
"fingerprint": "firefox",
"sni": "your_domain_name"
}
}
```

这个客户端配置使Trojan-Go开启一个监听在本地1080端口的socks5/http代理(自动识别),远端服务器为your_awesome_server:443,your_awesome_server可以是IP或者域名。

如果你在```remote_addr```中填写的是域名,```sni```可以省略。```sni```字段应当填写你申请证书的对应域名,或者你自己签发的证书的Common Name,而且必须一致。注意,```sni```字段目前的在TLS协议中是**明文传送**的(目的是使服务器提供相应证书)。GFW已经被证实具有SNI探测和阻断能力,所以不要填写类似```google.com```等已经被封锁的域名,否则很有可能导致你的服务器也被封锁。

```fingerprint```将设置Trojan-Go伪造Firefox浏览器的TLS请求指纹,使得Trojan-Go的流量混杂在正常的HTTPS流量中无法被识别。还可以设置为```ios``````chrome```,```randomized```等。
如果你在```remote_addr```中填写的是域名,```sni```可以省略。如果你在```remote_addr```填写的是IP地址,```sni```字段应当填写你申请证书的对应域名,或者你自己签发的证书的Common Name,而且必须一致。注意,```sni```字段目前的在TLS协议中是**明文传送**的(目的是使服务器提供相应证书)。GFW已经被证实具有SNI探测和阻断能力,所以不要填写类似```google.com```等已经被封锁的域名,否则很有可能导致你的服务器也被遭到锁。

更多关于配置文件的信息,可以在左侧导航栏中找到相应介绍。
12 changes: 5 additions & 7 deletions docs/content/basic/full-config.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ weight: 30
"reuse_session": true,
"plain_http_response": "",
"fallback_port": 0,
"fingerprint": ""
"fingerprint": "firefox"
},
"tcp": {
"no_delay": true,
Expand Down Expand Up @@ -172,21 +172,19 @@ weight: 30

```curves```指定TLS在ECDHE中偏好使用的椭圆曲线。只有你明确知道自己在做什么的情况下,才应该填写此项。曲线名称用分号(":")分隔。

```fingerprint```用于指定TLS Client Hello指纹伪造类型,以抵抗GFW对于TLS Client Hello指纹的特征识别和阻断。trojan-go使用[utls](https://github.com/refraction-networking/utls)进行指纹伪造。合法的值有
```fingerprint```用于指定TLS Client Hello指纹伪造类型,以抵抗GFW对于TLS Client Hello指纹的特征识别和阻断。trojan-go使用[utls](https://github.com/refraction-networking/utls)进行指纹伪造,默认伪造Firefox的指纹。合法的值有

- "",不使用指纹伪造

- "auto",自动选择(推荐)
- "auto",自动尝试并选择

- "firefox",伪造Firefox指纹
- "firefox",伪造Firefox指纹(默认)

- "chrome",伪造Chrome指纹

- "ios",伪造iOS指纹

- "randomized",随机指纹

一旦指纹的值被设置,```cipher``````curves``````alpn``````session_ticket```等有可能影响指纹的字段将使用该指纹的特定设置覆写。设置该选项有可能导致与服务器密钥协商失败,使用auto选项将自动尝试所有指纹并选出合适的一项。
一旦指纹的值被设置,```cipher``````curves``````alpn``````session_ticket```等有可能影响指纹的字段将使用该指纹的特定设置覆写。

```plain_http_response```指定了当TLS握手失败时,明文发送的原始数据(原始TCP数据)。这个字段填入该文件路径。推荐使用```fallback_port```而不是该字段。

Expand Down
4 changes: 0 additions & 4 deletions protocol/trojan/outbound.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,6 @@ type TrojanOutboundConnSession struct {
trojanHeader []byte
}

func (o *TrojanOutboundConnSession) SetMeter(meter stat.TrafficMeter) {
o.meter = meter
}

func (o *TrojanOutboundConnSession) Write(p []byte) (int, error) {
if o.trojanHeader != nil {
//send the payload after the trojan request header
Expand Down
Loading

0 comments on commit 2e9f8ab

Please sign in to comment.