mirror of
https://github.com/tailscale/tailscale.git
synced 2026-11-26 19:46:27 -08:00
Probe only counted the OK, not authorized and address mismatch PCP result codes. All other codes went to portmap_pcp_unhandled_response_code. This adds all RFC 6887 result codes. IANA has allocated more for RFCs 7652 and 7843, but we are leaving those out since we don't use authentication or third-party options. PCP replies with an opcode other than ANNOUNCE now go to a new portmap_pcp_unhandled_opcode metric instead of portmap_pcp_unhandled_response_code, same as NAT-PMP. Updates tailscale/corp#51202 Change-Id: I00bc0309914280c4238cb2aaa322a595fe94d699 Signed-off-by: Francois Marier <[email protected]>
41 lines
1.4 KiB
Go
41 lines
1.4 KiB
Go
// Copyright (c) Tailscale Inc & contributors
|
|
// SPDX-License-Identifier: BSD-3-Clause
|
|
|
|
// Code generated by "stringer -type=pcpResultCode -trimprefix=pcpCode"; DO NOT EDIT.
|
|
|
|
package portmapper
|
|
|
|
import "strconv"
|
|
|
|
func _() {
|
|
// An "invalid array index" compiler error signifies that the constant values have changed.
|
|
// Re-run the stringer command to generate them again.
|
|
var x [1]struct{}
|
|
_ = x[pcpCodeOK-0]
|
|
_ = x[pcpCodeUnsupportedVersion-1]
|
|
_ = x[pcpCodeNotAuthorized-2]
|
|
_ = x[pcpCodeMalformedRequest-3]
|
|
_ = x[pcpCodeUnsupportedOpcode-4]
|
|
_ = x[pcpCodeUnsupportedOption-5]
|
|
_ = x[pcpCodeMalformedOption-6]
|
|
_ = x[pcpCodeNetworkFailure-7]
|
|
_ = x[pcpCodeNoResources-8]
|
|
_ = x[pcpCodeUnsupportedProtocol-9]
|
|
_ = x[pcpCodeUserExceededQuota-10]
|
|
_ = x[pcpCodeCannotProvideExternal-11]
|
|
_ = x[pcpCodeAddressMismatch-12]
|
|
_ = x[pcpCodeExcessiveRemotePeers-13]
|
|
}
|
|
|
|
const _pcpResultCode_name = "OKUnsupportedVersionNotAuthorizedMalformedRequestUnsupportedOpcodeUnsupportedOptionMalformedOptionNetworkFailureNoResourcesUnsupportedProtocolUserExceededQuotaCannotProvideExternalAddressMismatchExcessiveRemotePeers"
|
|
|
|
var _pcpResultCode_index = [...]uint8{0, 2, 20, 33, 49, 66, 83, 98, 112, 123, 142, 159, 180, 195, 215}
|
|
|
|
func (i pcpResultCode) String() string {
|
|
idx := int(i) - 0
|
|
if i < 0 || idx >= len(_pcpResultCode_index)-1 {
|
|
return "pcpResultCode(" + strconv.FormatInt(int64(i), 10) + ")"
|
|
}
|
|
return _pcpResultCode_name[_pcpResultCode_index[idx]:_pcpResultCode_index[idx+1]]
|
|
}
|