github.com/elfadel/cilium@v1.6.12/pkg/datapath/fake/datapath.go (about) 1 // Copyright 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 fake 16 17 import ( 18 "io" 19 20 "github.com/cilium/cilium/pkg/datapath" 21 ) 22 23 type fakeDatapath struct { 24 node datapath.NodeHandler 25 nodeAddressing datapath.NodeAddressing 26 } 27 28 // NewDatapath returns a new fake datapath 29 func NewDatapath() datapath.Datapath { 30 return &fakeDatapath{ 31 node: NewNodeHandler(), 32 nodeAddressing: NewNodeAddressing(), 33 } 34 } 35 36 // Node returns a fake handler for node events 37 func (f *fakeDatapath) Node() datapath.NodeHandler { 38 return f.node 39 } 40 41 // LocalNodeAddressing returns a fake node addressing implementation of the 42 // local node 43 func (f *fakeDatapath) LocalNodeAddressing() datapath.NodeAddressing { 44 return f.nodeAddressing 45 } 46 47 // WriteNodeConfig pretends to write the datapath configuration to the writer. 48 func (f *fakeDatapath) WriteNodeConfig(io.Writer, *datapath.LocalNodeConfiguration) error { 49 return nil 50 } 51 52 // WriteNetdevConfig pretends to write the netdev configuration to a writer. 53 func (f *fakeDatapath) WriteNetdevConfig(io.Writer, datapath.DeviceConfiguration) error { 54 return nil 55 } 56 57 // WriteTemplateConfig pretends to write the endpoint configuration to a writer. 58 func (f *fakeDatapath) WriteTemplateConfig(io.Writer, datapath.EndpointConfiguration) error { 59 return nil 60 } 61 62 // WriteEndpointConfig pretends to write the endpoint configuration to a writer. 63 func (f *fakeDatapath) WriteEndpointConfig(io.Writer, datapath.EndpointConfiguration) error { 64 return nil 65 } 66 67 func (f *fakeDatapath) InstallProxyRules(uint16, bool, string) error { 68 return nil 69 } 70 71 func (f *fakeDatapath) RemoveProxyRules(uint16, bool, string) error { 72 return nil 73 } 74 75 func (f *fakeDatapath) SupportsOriginalSourceAddr() bool { 76 return false 77 }