Skip to content

Commit c3ee9f2

Browse files
committed
Merge branch 'master' of github.com:cbeuw/Cloak
2 parents d5a003d + a722730 commit c3ee9f2

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,12 @@ techniques).**
137137
`ServerName` is the domain you want to make your ISP or firewall _think_ you are visiting. Ideally it should
138138
match `RedirAddr` in the server's configuration, a major site the censor allows, but it doesn't have to.
139139

140+
`CDNOriginHost` is the domain name of the _origin_ server (i.e. the server running Cloak) under `CDN` mode. This only
141+
has effect when `Transport` is set to `CDN`. If unset, it will default to the remote hostname supplied via the
142+
commandline argument (in standalone mode), or by Shadowsocks (in plugin mode). After a TLS session is established with
143+
the CDN server, this domain name will be used in the HTTP request to ask the CDN server to establish a WebSocket
144+
connection with this host.
145+
140146
`NumConn` is the amount of underlying TCP connections you want to use. The default of 4 should be appropriate for most
141147
people. Setting it too high will hinder the performance. Setting it to 0 will disable connection multiplexing and each
142148
TCP connection will spawn a separate short-lived session that will be closed after it is terminated. This makes it

internal/client/state.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ type RawConfig struct {
3535
UDP bool // nullable
3636
BrowserSig string // nullable
3737
Transport string // nullable
38+
CDNOriginHost string // nullable
3839
StreamTimeout int // nullable
3940
KeepAlive int // nullable
4041
}
@@ -189,9 +190,16 @@ func (raw *RawConfig) ProcessRawConfig(worldState common.WorldState) (local Loca
189190
// Transport and (if TLS mode), browser
190191
switch strings.ToLower(raw.Transport) {
191192
case "cdn":
193+
var cdnDomainPort string
194+
if raw.CDNOriginHost == "" {
195+
cdnDomainPort = net.JoinHostPort(raw.RemoteHost, raw.RemotePort)
196+
} else {
197+
cdnDomainPort = net.JoinHostPort(raw.CDNOriginHost, raw.RemotePort)
198+
}
199+
192200
remote.TransportMaker = func() Transport {
193201
return &WSOverTLS{
194-
cdnDomainPort: remote.RemoteAddr,
202+
cdnDomainPort: cdnDomainPort,
195203
}
196204
}
197205
case "direct":

0 commit comments

Comments
 (0)