github.com/noisysockets/netstack@v0.6.0/pkg/tcpip/header/ndpoptionidentifier_string.go (about)

     1  // Copyright 2020 The gVisor Authors.
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  //
     7  //     http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  // See the License for the specific language governing permissions and
    13  // limitations under the License.
    14  
    15  // Code generated by "stringer -type ndpOptionIdentifier"; DO NOT EDIT.
    16  
    17  package header
    18  
    19  import "strconv"
    20  
    21  func _() {
    22  	// An "invalid array index" compiler error signifies that the constant values have changed.
    23  	// Re-run the stringer command to generate them again.
    24  	var x [1]struct{}
    25  	_ = x[ndpSourceLinkLayerAddressOptionType-1]
    26  	_ = x[ndpTargetLinkLayerAddressOptionType-2]
    27  	_ = x[ndpPrefixInformationType-3]
    28  	_ = x[ndpNonceOptionType-14]
    29  	_ = x[ndpRecursiveDNSServerOptionType-25]
    30  	_ = x[ndpDNSSearchListOptionType-31]
    31  }
    32  
    33  const (
    34  	_ndpOptionIdentifier_name_0 = "ndpSourceLinkLayerAddressOptionTypendpTargetLinkLayerAddressOptionTypendpPrefixInformationType"
    35  	_ndpOptionIdentifier_name_1 = "ndpNonceOptionType"
    36  	_ndpOptionIdentifier_name_2 = "ndpRecursiveDNSServerOptionType"
    37  	_ndpOptionIdentifier_name_3 = "ndpDNSSearchListOptionType"
    38  )
    39  
    40  var (
    41  	_ndpOptionIdentifier_index_0 = [...]uint8{0, 35, 70, 94}
    42  )
    43  
    44  func (i ndpOptionIdentifier) String() string {
    45  	switch {
    46  	case 1 <= i && i <= 3:
    47  		i -= 1
    48  		return _ndpOptionIdentifier_name_0[_ndpOptionIdentifier_index_0[i]:_ndpOptionIdentifier_index_0[i+1]]
    49  	case i == 14:
    50  		return _ndpOptionIdentifier_name_1
    51  	case i == 25:
    52  		return _ndpOptionIdentifier_name_2
    53  	case i == 31:
    54  		return _ndpOptionIdentifier_name_3
    55  	default:
    56  		return "ndpOptionIdentifier(" + strconv.FormatInt(int64(i), 10) + ")"
    57  	}
    58  }