@@ -29,9 +29,10 @@ import (
2929
3030// github.com/Windscribe/browser-extension/blob/ed83749ad/modules/ext/src/utils/constants.js#L31
3131const (
32- svchost = "svc.rethinkdns.com"
33- wsMyIp = "https://checkip.windscribe.com/"
34- wsMyIp2 = "https://checkip.totallyacdn.com/"
32+ svchost = "svc.rethinkdns.com"
33+ svchosttest = "redir.nile.workers.dev"
34+ wsMyIp = "https://checkip.windscribe.com/"
35+ wsMyIp2 = "https://checkip.totallyacdn.com/"
3536)
3637
3738const (
@@ -116,6 +117,7 @@ var (
116117 errWsNoClient = errors .New ("ws: no client" )
117118 errWsNoEntitlement = errors .New ("ws: missing entitlement" )
118119 errWsNoToken = errors .New ("ws: missing token" )
120+ errWsNoCid = errors .New ("ws: missing cid" )
119121 errWsNoResponse = errors .New ("ws: no response" )
120122 errWsNoLocHash = errors .New ("ws: no loc hash" )
121123 errWsNoServerList = errors .New ("ws: no server list" )
@@ -895,12 +897,12 @@ func fixedValidWsEndpoint(test bool) string {
895897 return "ca.windscribe.com"
896898}
897899
898- func baseurl (test bool ) * url.URL {
900+ func baseurl (test bool , cid string ) * url.URL {
899901 u := url.URL {
900902 Scheme : "https" ,
901- Host : svchost ,
903+ Host : svchosttest ,
902904 }
903-
905+ u . Query (). Set ( "cid" , cid )
904906 if test {
905907 u .Query ().Set ("rpn" , "wstest" )
906908 } else {
@@ -913,7 +915,7 @@ func baseurl(test bool) *url.URL {
913915func assetsurl (test bool ) * url.URL {
914916 u := url.URL {
915917 Scheme : "https" ,
916- Host : svchost ,
918+ Host : svchosttest ,
917919 }
918920
919921 if test {
@@ -975,7 +977,7 @@ func wsRes[T any](res *http.Response, out *T, op string) (*T, error) {
975977 return out , nil
976978}
977979
978- func getSession (h * http.Client , tok string , test bool ) (* WsSession , error ) {
980+ func getSession (h * http.Client , cid , tok string , test bool ) (* WsSession , error ) {
979981 if len (tok ) <= 0 {
980982 return nil , errWsNoToken
981983 }
@@ -984,7 +986,7 @@ func getSession(h *http.Client, tok string, test bool) (*WsSession, error) {
984986 curl -x GET '.../Session'
985987 -H 'Authorization: Bearer id:typ:epochsec:sig1:sig2'
986988 */
987- u := baseurl (test ).JoinPath (wssessionpath )
989+ u := baseurl (test , cid ).JoinPath (wssessionpath )
988990 req , err := http .NewRequest ("GET" , u .String (), nil )
989991 if err != nil {
990992 return nil , fmt .Errorf ("ws: getsess: make req err: %v" , err )
@@ -1191,6 +1193,10 @@ func genWgConfs(h *http.Client, existingCreds *WsWgCreds, sess *WsSession, serve
11911193 if len (bearer ) <= 0 {
11921194 return nil , nil , errWsNoToken
11931195 }
1196+ cid := ent .Cid
1197+ if len (cid ) <= 0 {
1198+ return nil , nil , errWsNoCid
1199+ }
11941200 test := ent .Test
11951201
11961202 tokst := "sess-" + tokenState (bearer )
@@ -1234,7 +1240,7 @@ initagain:
12341240 initdata := url.Values {}
12351241 initdata .Set ("wg_pubkey" , pubkeybase64 )
12361242 initdata .Set ("force_init" , force )
1237- u := baseurl (test ).JoinPath (wswginitpath )
1243+ u := baseurl (test , cid ).JoinPath (wswginitpath )
12381244 initreq , err := http .NewRequest ("POST" , u .String (), strings .NewReader (initdata .Encode ()))
12391245 if err != nil {
12401246 return nil , nil , fmt .Errorf ("ws: wgconfs: req err: %v" , err )
@@ -1311,7 +1317,7 @@ initagain:
13111317 cdata .Set ("hostname" , someEndpoint )
13121318 cdata .Set ("wg_pubkey" , pubkeybase64 )
13131319 cdata .Set ("wg_ttl" , wgttl )
1314- u := baseurl (test ).JoinPath (wswgconnectpath )
1320+ u := baseurl (test , cid ).JoinPath (wswgconnectpath )
13151321 creq , err := http .NewRequest ("POST" , u .String (), strings .NewReader (cdata .Encode ()))
13161322 if err != nil {
13171323 return nil , nil , fmt .Errorf ("ws: wgconfs: connect req err: %v" , err )
@@ -1432,7 +1438,7 @@ func makeWsWg(h *http.Client, ent *WsEntitlement) (*WsClient, error) {
14321438 return nil , errWsNoEntitlement
14331439 }
14341440
1435- sess , err := getSession (h , ent .SessionToken , ent .Test )
1441+ sess , err := getSession (h , ent .Cid , ent . SessionToken , ent .Test )
14361442 if err != nil {
14371443 return nil , err
14381444 }
@@ -1499,14 +1505,15 @@ func makeWsWgFrom(h *http.Client, existingConf *WsWgConfig) (ws *WsClient, refre
14991505 return
15001506 }
15011507
1508+ cid := existingEnt .Cid
15021509 tokst := existingConf .tokenState ()
15031510 existingToken := existingEnt .SessionToken
15041511 existingLocHash := existingSess .LocHash
15051512 if existingEnt .SessionToken != existingToken {
15061513 log .W ("ws: make: entitlement does not match session; tok? %s" , tokst )
15071514 }
15081515
1509- newSess , err := getSession (h , existingToken , existingEnt .Test )
1516+ newSess , err := getSession (h , cid , existingToken , existingEnt .Test )
15101517 if err == nil {
15111518 existingConf .Session = newSess // update session with the latest info
15121519 refreshedSess = true
0 commit comments