|
|
@ -688,11 +688,13 @@ func (c *Client) Probe(ctx context.Context) (res ProbeResult, err error) {
|
|
|
|
if c.sawPMPRecently() {
|
|
|
|
if c.sawPMPRecently() {
|
|
|
|
res.PMP = true
|
|
|
|
res.PMP = true
|
|
|
|
} else if !DisablePMP {
|
|
|
|
} else if !DisablePMP {
|
|
|
|
|
|
|
|
metricPMPSent.Add(1)
|
|
|
|
uc.WriteTo(pmpReqExternalAddrPacket, pxpAddr)
|
|
|
|
uc.WriteTo(pmpReqExternalAddrPacket, pxpAddr)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if c.sawPCPRecently() {
|
|
|
|
if c.sawPCPRecently() {
|
|
|
|
res.PCP = true
|
|
|
|
res.PCP = true
|
|
|
|
} else if !DisablePCP {
|
|
|
|
} else if !DisablePCP {
|
|
|
|
|
|
|
|
metricPCPSent.Add(1)
|
|
|
|
uc.WriteTo(pcpAnnounceRequest(myIP), pxpAddr)
|
|
|
|
uc.WriteTo(pcpAnnounceRequest(myIP), pxpAddr)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if c.sawUPnPRecently() {
|
|
|
|
if c.sawUPnPRecently() {
|
|
|
@ -783,6 +785,7 @@ func (c *Client) Probe(ctx context.Context) (res ProbeResult, err error) {
|
|
|
|
c.mu.Unlock()
|
|
|
|
c.mu.Unlock()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
case c.pxpPort(): // same value for PMP and PCP
|
|
|
|
case c.pxpPort(): // same value for PMP and PCP
|
|
|
|
|
|
|
|
metricPXPResponse.Add(1)
|
|
|
|
if pres, ok := parsePCPResponse(buf[:n]); ok {
|
|
|
|
if pres, ok := parsePCPResponse(buf[:n]); ok {
|
|
|
|
if pres.OpCode == pcpOpReply|pcpOpAnnounce {
|
|
|
|
if pres.OpCode == pcpOpReply|pcpOpAnnounce {
|
|
|
|
pcpHeard = true
|
|
|
|
pcpHeard = true
|
|
|
@ -865,6 +868,12 @@ var uPnPPacket = []byte("M-SEARCH * HTTP/1.1\r\n" +
|
|
|
|
|
|
|
|
|
|
|
|
// PCP/PMP metrics
|
|
|
|
// PCP/PMP metrics
|
|
|
|
var (
|
|
|
|
var (
|
|
|
|
|
|
|
|
// metricPXPResponse counts the number of times we received a PMP/PCP response.
|
|
|
|
|
|
|
|
metricPXPResponse = clientmetric.NewCounter("portmap_pxp_response")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// metricPCPSent counts the number of times we sent a PCP request.
|
|
|
|
|
|
|
|
metricPCPSent = clientmetric.NewCounter("portmap_pcp_sent")
|
|
|
|
|
|
|
|
|
|
|
|
// metricPCPOK counts the number of times
|
|
|
|
// metricPCPOK counts the number of times
|
|
|
|
// we received a successful PCP response.
|
|
|
|
// we received a successful PCP response.
|
|
|
|
metricPCPOK = clientmetric.NewCounter("portmap_pcp_ok")
|
|
|
|
metricPCPOK = clientmetric.NewCounter("portmap_pcp_ok")
|
|
|
@ -881,6 +890,9 @@ var (
|
|
|
|
// we received an (as yet) unhandled PCP result code.
|
|
|
|
// we received an (as yet) unhandled PCP result code.
|
|
|
|
metricPCPUnhandledResponseCode = clientmetric.NewCounter("portmap_pcp_unhandled_response_code")
|
|
|
|
metricPCPUnhandledResponseCode = clientmetric.NewCounter("portmap_pcp_unhandled_response_code")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// metricPMPSent counts the number of times we sent a PMP request.
|
|
|
|
|
|
|
|
metricPMPSent = clientmetric.NewCounter("portmap_pmp_sent")
|
|
|
|
|
|
|
|
|
|
|
|
// metricPMPOK counts the number of times
|
|
|
|
// metricPMPOK counts the number of times
|
|
|
|
// we received a succesful PMP response.
|
|
|
|
// we received a succesful PMP response.
|
|
|
|
metricPMPOK = clientmetric.NewCounter("portmap_pmp_ok")
|
|
|
|
metricPMPOK = clientmetric.NewCounter("portmap_pmp_ok")
|
|
|
|