libnetwork: remove Endpoint.Interface

This method is not part of any interface, and identical to Endpoint.Iface,
but one returns an Interface-type (driverapi.InterfaceInfo) and the other
returns a concrete type (EndpointInterface).

Interface-matching should generally happen on the receiver side, and this
function was only used in a single location, and passed as argument to
Driver.CreateEndpoint, which already matches the interface by accepting
a driverapi.InterfaceInfo.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2023-08-27 14:37:10 +02:00
parent f8181b8875
commit 8b21609654
No known key found for this signature in database
GPG key ID: 76698F39D527CE8C
2 changed files with 1 additions and 7 deletions

View file

@ -206,12 +206,6 @@ func (ep *Endpoint) Iface() *EndpointInterface {
return ep.iface return ep.iface
} }
func (ep *Endpoint) Interface() driverapi.InterfaceInfo {
ep.mu.Lock()
defer ep.mu.Unlock()
return ep.iface
}
// SetMacAddress allows the driver to set the mac address to the endpoint interface // SetMacAddress allows the driver to set the mac address to the endpoint interface
// during the call to CreateEndpoint, if the mac address is not already set. // during the call to CreateEndpoint, if the mac address is not already set.
func (epi *EndpointInterface) SetMacAddress(mac net.HardwareAddr) error { func (epi *EndpointInterface) SetMacAddress(mac net.HardwareAddr) error {

View file

@ -1085,7 +1085,7 @@ func (n *Network) addEndpoint(ep *Endpoint) error {
return fmt.Errorf("failed to add endpoint: %v", err) return fmt.Errorf("failed to add endpoint: %v", err)
} }
err = d.CreateEndpoint(n.id, ep.id, ep.Interface(), ep.generic) err = d.CreateEndpoint(n.id, ep.id, ep.Iface(), ep.generic)
if err != nil { if err != nil {
return types.InternalErrorf("failed to create endpoint %s on network %s: %v", return types.InternalErrorf("failed to create endpoint %s on network %s: %v",
ep.Name(), n.Name(), err) ep.Name(), n.Name(), err)