Skip to content

Commit 70b9d34

Browse files
committed
rpn/proton: flag to use pre-defined endpoints only
1 parent 854b5d1 commit 70b9d34

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

intra/ipn/warp/proton.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,9 @@ func (o apiStatus) String() string {
112112
}
113113
}
114114

115+
// mostly ... for tests
116+
const usePrebuiltLogicalsOnly = false
117+
115118
var protonLogicalsUpdateTime = time.Time{}
116119

117120
var defaultLoginPayload = ProtonLoginPayload{
@@ -1292,6 +1295,11 @@ func (a *ProtonClient) reg() error {
12921295
}
12931296

12941297
func (a *ProtonClient) refreshServers() error {
1298+
if usePrebuiltLogicalsOnly {
1299+
log.I("proton: refresh servers: no-op; only prebuilts")
1300+
return nil
1301+
}
1302+
12951303
const nofile = ""
12961304

12971305
oldEnough := time.Since(protonLogicalsUpdateTime) > maxProtonLogicalsRefreshThreshold
@@ -1562,6 +1570,11 @@ func protonServersFrom(allServersFilePath string, c *http.Client) []ProtonLogica
15621570

15631571
prebuilts := protonServersPrebuilt()
15641572

1573+
if usePrebuiltLogicalsOnly {
1574+
log.I("proton: servers: using prebuilt servers only")
1575+
return prebuilts
1576+
}
1577+
15651578
if len(allServersFilePath) > 0 {
15661579
fp := filepath.Clean(allServersFilePath)
15671580
f, err := os.OpenFile(fp, os.O_RDONLY, 0)

0 commit comments

Comments
 (0)