github.com/looshlee/beatles@v0.0.0-20220727174639-742810ab631c/pkg/datapath/node_addressing.go (about) 1 // Copyright 2018-2019 Authors of Cilium 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 package datapath 16 17 import ( 18 "net" 19 20 "github.com/cilium/cilium/pkg/cidr" 21 ) 22 23 // NodeAddressingFamily is the node addressing information for a particular 24 // address family 25 type NodeAddressingFamily interface { 26 // Router is the address that will act as the router on each node where 27 // an agent is running on. Endpoints have a default route that points 28 // to this address. 29 Router() net.IP 30 31 // PrimaryExternal is the primary external address of the node. Nodes 32 // must be able to reach each other via this address. 33 PrimaryExternal() net.IP 34 35 // AllocationCIDR is the CIDR used for IP allocation of all endpoints 36 // on the node 37 AllocationCIDR() *cidr.CIDR 38 39 // LocalAddresses lists all local addresses 40 LocalAddresses() ([]net.IP, error) 41 } 42 43 // NodeAddressing implements addressing of a node 44 type NodeAddressing interface { 45 IPv6() NodeAddressingFamily 46 IPv4() NodeAddressingFamily 47 }