1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-06-12 10:50:43 +00:00

feat: Replace default Health Ping URL to HTTPS (#1991)

This commit is contained in:
Bernd Eichelberger 2022-09-19 10:03:43 +02:00 committed by GitHub
parent 0cf7ac64da
commit 5bc04f3269
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 4 deletions

View File

@ -77,7 +77,7 @@ type HealthPingConfig struct {
unknownFields protoimpl.UnknownFields
// destination url, need 204 for success return
// default http://www.google.com/gen_204
// default https://connectivitycheck.gstatic.com/generate_204
Destination string `protobuf:"bytes,1,opt,name=destination,proto3" json:"destination,omitempty"`
// connectivity check url
Connectivity string `protobuf:"bytes,2,opt,name=connectivity,proto3" json:"connectivity,omitempty"`

View File

@ -21,7 +21,7 @@ message Config {
message HealthPingConfig {
// destination url, need 204 for success return
// default http://www.google.com/gen_204
// default https://connectivitycheck.gstatic.com/generate_204
string destination = 1;
// connectivity check url
string connectivity = 2;
@ -31,4 +31,4 @@ message HealthPingConfig {
int32 samplingCount = 4;
// ping timeout, int64 values of time.Duration
int64 timeout = 5;
}
}

View File

@ -43,7 +43,10 @@ func NewHealthPing(ctx context.Context, config *HealthPingConfig) *HealthPing {
}
}
if settings.Destination == "" {
settings.Destination = "http://www.google.com/gen_204"
// Destination URL, need 204 for success return default to chromium
// https://github.com/chromium/chromium/blob/main/components/safety_check/url_constants.cc#L10
// https://chromium.googlesource.com/chromium/src/+/refs/heads/main/components/safety_check/url_constants.cc#10
settings.Destination = "https://connectivitycheck.gstatic.com/generate_204"
}
if settings.Interval == 0 {
settings.Interval = time.Duration(1) * time.Minute