netlink_unsupported.go 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. // +build !linux
  2. /*
  3. Copyright 2017 The Kubernetes Authors.
  4. Licensed under the Apache License, Version 2.0 (the "License");
  5. you may not use this file except in compliance with the License.
  6. You may obtain a copy of the License at
  7. http://www.apache.org/licenses/LICENSE-2.0
  8. Unless required by applicable law or agreed to in writing, software
  9. distributed under the License is distributed on an "AS IS" BASIS,
  10. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  11. See the License for the specific language governing permissions and
  12. limitations under the License.
  13. */
  14. package ipvs
  15. import (
  16. "fmt"
  17. "k8s.io/apimachinery/pkg/util/sets"
  18. )
  19. type emptyHandle struct {
  20. }
  21. // NewNetLinkHandle will create an EmptyHandle
  22. func NewNetLinkHandle(ipv6 bool) NetLinkHandle {
  23. return &emptyHandle{}
  24. }
  25. // EnsureAddressBind checks if address is bound to the interface and, if not, binds it. If the address is already bound, return true.
  26. func (h *emptyHandle) EnsureAddressBind(address, devName string) (exist bool, err error) {
  27. return false, fmt.Errorf("netlink not supported for this platform")
  28. }
  29. // UnbindAddress unbind address from the interface
  30. func (h *emptyHandle) UnbindAddress(address, devName string) error {
  31. return fmt.Errorf("netlink not supported for this platform")
  32. }
  33. // EnsureDummyDevice is part of interface
  34. func (h *emptyHandle) EnsureDummyDevice(devName string) (bool, error) {
  35. return false, fmt.Errorf("netlink is not supported in this platform")
  36. }
  37. // DeleteDummyDevice is part of interface.
  38. func (h *emptyHandle) DeleteDummyDevice(devName string) error {
  39. return fmt.Errorf("netlink is not supported in this platform")
  40. }
  41. // ListBindAddress is part of interface.
  42. func (h *emptyHandle) ListBindAddress(devName string) ([]string, error) {
  43. return nil, fmt.Errorf("netlink is not supported in this platform")
  44. }
  45. // GetLocalAddresses is part of interface.
  46. func (h *emptyHandle) GetLocalAddresses(dev, filterDev string) (sets.String, error) {
  47. return nil, fmt.Errorf("netlink is not supported in this platform")
  48. }