Documentation ¶
Overview ¶
Copyright 2016 Authors of Cilium
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2016 Authors of Cilium ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2016 Authors of Cilium ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- Constants
- Variables
- type CiliumIP
- type CiliumIPv4
- func (ip CiliumIPv4) EndpointID() uint16
- func (ip CiliumIPv4) IP() net.IP
- func (ip CiliumIPv4) IPAMReq() ipam.IPAMReq
- func (ip CiliumIPv4) IPNet(ones int) *net.IPNet
- func (ip CiliumIPv4) MarshalJSON() ([]byte, error)
- func (ip CiliumIPv4) NodeID() uint32
- func (ip CiliumIPv4) NodeIP() net.IP
- func (ip CiliumIPv4) String() string
- func (ip *CiliumIPv4) UnmarshalJSON(b []byte) error
- func (ip CiliumIPv4) ValidContainerIP() bool
- func (ip CiliumIPv4) ValidNodeIP() bool
- type CiliumIPv6
- func (ip CiliumIPv6) EndpointID() uint16
- func (ip CiliumIPv6) HostIP() net.IP
- func (ip CiliumIPv6) IP() net.IP
- func (ip CiliumIPv6) IPAMReq() ipam.IPAMReq
- func (ip CiliumIPv6) IPNet(ones int) *net.IPNet
- func (ip CiliumIPv6) MarshalJSON() ([]byte, error)
- func (ip CiliumIPv6) NodeID() uint32
- func (ip CiliumIPv6) NodeIP() net.IP
- func (ip CiliumIPv6) State() uint16
- func (ip CiliumIPv6) String() string
- func (ip *CiliumIPv6) UnmarshalJSON(b []byte) error
- func (ip CiliumIPv6) ValidContainerIP() bool
- func (ip *CiliumIPv6) ValidNodeIP() bool
- type NodeAddress
Constants ¶
const ( // Default prefix for all IPv6 addresses. DefaultIPv6Prefix = "f00d::" // Prefix length to allocate container IPv6 addresses from DefaultIPv6PrefixLen = 112 // Default prefix for all IPv4 addresses. %d is substituted with the // last byte of first global IPv4 address configured on the system. DefaultIPv4Prefix = "10.%d.0.1" // Prefix length to allocate container IPv4 addresses from DefaultIPv4PrefixLen = 16 // Default IPv4 prefix length of entire cluster DefaultIPv4ClusterPrefixLen = 8 // Default IPv6 prefix to represent NATed IPv4 addresses DefaultNAT46Prefix = "aa46::/48" )
Variables ¶
var ( // ClusterIPv6Mask represents the CIDR Mask for an entire cluster ClusterIPv6Mask = net.CIDRMask(64, 128) // NodeIPv6Mask represents the CIDR Mask for the cilium node. NodeIPv6Mask = net.CIDRMask(96, 128) // StateIPv6Mask represents the CIDR Mask for the state position. StateIPv6Mask = net.CIDRMask(112, 128) // IPv6 prefix length for address assigned to container. The default is // L3 only and thus /128. ContainerIPv6Mask = net.CIDRMask(128, 128) // IPv4 prefix length for address assigned to container. The default is // L3 only and thus /32 ContainerIPv4Mask = net.CIDRMask(32, 32) IPv6DefaultRoute = net.IPNet{IP: net.IPv6zero, Mask: net.CIDRMask(0, 128)} IPv4DefaultRoute = net.IPNet{IP: net.IPv4zero, Mask: net.CIDRMask(0, 32)} )
Functions ¶
This section is empty.
Types ¶
type CiliumIPv4 ¶
type CiliumIPv4 []byte
func DeriveCiliumIPv4 ¶
func DeriveCiliumIPv4(src net.IP) CiliumIPv4
func NewCiliumIPv4 ¶
func NewCiliumIPv4(address string) (CiliumIPv4, error)
func (CiliumIPv4) EndpointID ¶
func (ip CiliumIPv4) EndpointID() uint16
func (CiliumIPv4) IP ¶
func (ip CiliumIPv4) IP() net.IP
func (CiliumIPv4) IPAMReq ¶
func (ip CiliumIPv4) IPAMReq() ipam.IPAMReq
func (CiliumIPv4) MarshalJSON ¶
func (ip CiliumIPv4) MarshalJSON() ([]byte, error)
func (CiliumIPv4) NodeID ¶
func (ip CiliumIPv4) NodeID() uint32
func (CiliumIPv4) NodeIP ¶
func (ip CiliumIPv4) NodeIP() net.IP
NodeIP() return the node's IP based on an endpoint IP of the local node
func (CiliumIPv4) String ¶
func (ip CiliumIPv4) String() string
func (*CiliumIPv4) UnmarshalJSON ¶
func (ip *CiliumIPv4) UnmarshalJSON(b []byte) error
func (CiliumIPv4) ValidContainerIP ¶
func (ip CiliumIPv4) ValidContainerIP() bool
Returns true if the IPv4 address is a valid IP for a container To be valid must obey to the following rules: - Node ID, bits from 0 to 16, must be different than 0 - Endpoint ID, bits from 16 to 32, must be different than 0
func (CiliumIPv4) ValidNodeIP ¶
func (ip CiliumIPv4) ValidNodeIP() bool
Returns true if the IPv4 address is a valid IP of a node
type CiliumIPv6 ¶
type CiliumIPv6 []byte
func DeriveCiliumIPv6 ¶
func DeriveCiliumIPv6(src net.IP) CiliumIPv6
func NewCiliumIPv6 ¶
func NewCiliumIPv6(address string) (CiliumIPv6, error)
- Be an IPv6 address - Node ID, bits from 112 to 120, must be different than 0 - Endpoint ID, bits from 120 to 128, must be equal to 0
func (CiliumIPv6) EndpointID ¶
func (ip CiliumIPv6) EndpointID() uint16
Returns the container ID portion of the address or 0
func (CiliumIPv6) HostIP ¶
func (ip CiliumIPv6) HostIP() net.IP
Returns the host address from the node ID
func (CiliumIPv6) IP ¶
func (ip CiliumIPv6) IP() net.IP
func (CiliumIPv6) IPAMReq ¶
func (ip CiliumIPv6) IPAMReq() ipam.IPAMReq
func (CiliumIPv6) MarshalJSON ¶
func (ip CiliumIPv6) MarshalJSON() ([]byte, error)
func (CiliumIPv6) NodeID ¶
func (ip CiliumIPv6) NodeID() uint32
Returns the node ID portion of the address or 0
func (CiliumIPv6) NodeIP ¶
func (ip CiliumIPv6) NodeIP() net.IP
NodeIP() return the node's IP based on an endpoint IP of the local node
func (CiliumIPv6) State ¶
func (ip CiliumIPv6) State() uint16
func (CiliumIPv6) String ¶
func (ip CiliumIPv6) String() string
func (*CiliumIPv6) UnmarshalJSON ¶
func (ip *CiliumIPv6) UnmarshalJSON(b []byte) error
func (CiliumIPv6) ValidContainerIP ¶
func (ip CiliumIPv6) ValidContainerIP() bool
Returns true if IP is a valid IP for a container To be valid must obey to the following rules: - Node ID, bits from 64 to 96, must be different than 0 - State, bits from 96 to 112, must be 0 - Endpoint ID, bits from 112 to 128, must be different than 0
func (*CiliumIPv6) ValidNodeIP ¶
func (ip *CiliumIPv6) ValidNodeIP() bool
Returns true if IP is a valid IP of a node - Node ID, bits from 64 to 96, must be different than 0 - State, bits from 96 to 112, must be 0 - Endpoint ID, bits from 112 to 128, must be 0
type NodeAddress ¶
type NodeAddress struct { IPv6Address CiliumIPv6 IPv6Route net.IPNet IPv4Address CiliumIPv4 IPv4Route net.IPNet }
func NewNodeAddress ¶
func NewNodeAddress(v6Address string, ipv4Range string, device string) (*NodeAddress, error)
Allocate new node address
func (*NodeAddress) IPv4AllocRange ¶
func (a *NodeAddress) IPv4AllocRange() *net.IPNet
func (*NodeAddress) IPv4ClusterRange ¶
func (a *NodeAddress) IPv4ClusterRange() *net.IPNet
func (*NodeAddress) IPv6AllocRange ¶
func (a *NodeAddress) IPv6AllocRange() *net.IPNet
func (*NodeAddress) String ¶
func (a *NodeAddress) String() string