...

Source file src/k8s.io/kubernetes/pkg/proxy/ipvs/ipset/types.go

Documentation: k8s.io/kubernetes/pkg/proxy/ipvs/ipset

     1  //go:build linux
     2  // +build linux
     3  
     4  /*
     5  Copyright 2017 The Kubernetes Authors.
     6  
     7  Licensed under the Apache License, Version 2.0 (the "License");
     8  you may not use this file except in compliance with the License.
     9  You may obtain a copy of the License at
    10  
    11      http://www.apache.org/licenses/LICENSE-2.0
    12  
    13  Unless required by applicable law or agreed to in writing, software
    14  distributed under the License is distributed on an "AS IS" BASIS,
    15  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    16  See the License for the specific language governing permissions and
    17  limitations under the License.
    18  */
    19  
    20  package ipset
    21  
    22  // Type represents the ipset type
    23  type Type string
    24  
    25  const (
    26  	// HashIPPort represents the `hash:ip,port` type ipset.  The hash:ip,port is similar to hash:ip but
    27  	// you can store IP address and protocol-port pairs in it.  TCP, SCTP, UDP, UDPLITE, ICMP and ICMPv6 are supported
    28  	// with port numbers/ICMP(v6) types and other protocol numbers without port information.
    29  	HashIPPort Type = "hash:ip,port"
    30  	// HashIPPortIP represents the `hash:ip,port,ip` type ipset.  The hash:ip,port,ip set type uses a hash to store
    31  	// IP address, port number and a second IP address triples.  The port number is interpreted together with a
    32  	// protocol (default TCP) and zero protocol number cannot be used.
    33  	HashIPPortIP Type = "hash:ip,port,ip"
    34  	// HashIPPortNet represents the `hash:ip,port,net` type ipset.  The hash:ip,port,net set type uses a hash to store IP address, port number and IP network address triples.  The port
    35  	// number is interpreted together with a protocol (default TCP) and zero protocol number cannot be used.   Network address
    36  	// with zero prefix size cannot be stored either.
    37  	HashIPPortNet Type = "hash:ip,port,net"
    38  	// BitmapPort represents the `bitmap:port` type ipset.  The bitmap:port set type uses a memory range, where each bit
    39  	// represents one TCP/UDP port.  A bitmap:port type of set can store up to 65535 ports.
    40  	BitmapPort Type = "bitmap:port"
    41  	// HashIP represents the `hash:ip` type ipset.
    42  	HashIP Type = "hash:ip"
    43  )
    44  
    45  // DefaultPortRange defines the default bitmap:port valid port range.
    46  const DefaultPortRange string = "0-65535"
    47  
    48  const (
    49  	// ProtocolFamilyIPV4 represents IPv4 protocol.
    50  	ProtocolFamilyIPV4 = "inet"
    51  	// ProtocolFamilyIPV6 represents IPv6 protocol.
    52  	ProtocolFamilyIPV6 = "inet6"
    53  	// ProtocolTCP represents TCP protocol.
    54  	ProtocolTCP = "tcp"
    55  	// ProtocolUDP represents UDP protocol.
    56  	ProtocolUDP = "udp"
    57  	// ProtocolSCTP represents SCTP protocol.
    58  	ProtocolSCTP = "sctp"
    59  )
    60  
    61  // ValidIPSetTypes defines the supported ip set type.
    62  var ValidIPSetTypes = []Type{
    63  	HashIPPort,
    64  	HashIPPortIP,
    65  	BitmapPort,
    66  	HashIPPortNet,
    67  	HashIP,
    68  }
    69  

View as plain text