add globalping param
parent
ca714711a5
commit
8db037e981
|
|
@ -64,10 +64,14 @@ export async function getStatusWithGlobalPing(monitor: MonitorTarget): Promise<{
|
||||||
globalPingRequest = {
|
globalPingRequest = {
|
||||||
type: 'ping',
|
type: 'ping',
|
||||||
target: targetUrl.hostname,
|
target: targetUrl.hostname,
|
||||||
|
locations: [{
|
||||||
|
magic: gpUrl.searchParams.get('magic') || ''
|
||||||
|
}],
|
||||||
measurementOptions: {
|
measurementOptions: {
|
||||||
port: targetUrl.port,
|
port: targetUrl.port,
|
||||||
packets: 1,
|
packets: 1,
|
||||||
protocol: 'tcp'
|
protocol: 'tcp',
|
||||||
|
ipVersion: Number(gpUrl.searchParams.get('ipVersion') || 4)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -81,6 +85,9 @@ export async function getStatusWithGlobalPing(monitor: MonitorTarget): Promise<{
|
||||||
globalPingRequest = {
|
globalPingRequest = {
|
||||||
type: 'http',
|
type: 'http',
|
||||||
target: targetUrl.hostname,
|
target: targetUrl.hostname,
|
||||||
|
locations: [{
|
||||||
|
magic: gpUrl.searchParams.get('magic') || ''
|
||||||
|
}],
|
||||||
measurementOptions: {
|
measurementOptions: {
|
||||||
request: {
|
request: {
|
||||||
method: monitor.method,
|
method: monitor.method,
|
||||||
|
|
@ -89,7 +96,8 @@ export async function getStatusWithGlobalPing(monitor: MonitorTarget): Promise<{
|
||||||
headers: Object.fromEntries(Object.entries(monitor.headers ?? {}).map(([key, value]) => [key, String(value)])) // TODO: headers
|
headers: Object.fromEntries(Object.entries(monitor.headers ?? {}).map(([key, value]) => [key, String(value)])) // TODO: headers
|
||||||
},
|
},
|
||||||
port: targetUrl.port === "" ? (targetUrl.protocol === 'http:' ? 80 : 443) : Number(targetUrl.port),
|
port: targetUrl.port === "" ? (targetUrl.protocol === 'http:' ? 80 : 443) : Number(targetUrl.port),
|
||||||
protocol: targetUrl.protocol.replace(':', '')
|
protocol: targetUrl.protocol.replace(':', ''),
|
||||||
|
ipVersion: Number(gpUrl.searchParams.get('ipVersion') || 4)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -159,8 +167,8 @@ export async function getStatusWithGlobalPing(monitor: MonitorTarget): Promise<{
|
||||||
}
|
}
|
||||||
|
|
||||||
if (monitor.target.toLowerCase().startsWith('https') && !measurementResult.results[0].result.tls.authorized) {
|
if (monitor.target.toLowerCase().startsWith('https') && !measurementResult.results[0].result.tls.authorized) {
|
||||||
console.log(`${monitor.name} TLS certificate not trusted`)
|
console.log(`${monitor.name} TLS certificate not trusted: ${measurementResult.results[0].result.tls.error}`)
|
||||||
err = 'TLS certificate not trusted'
|
err = 'TLS certificate not trusted: ' + measurementResult.results[0].result.tls.error
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue