conn_unsupported.go 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. // Copyright 2019 Yunion
  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. // Copyright 2019 Yunion
  15. // Copyright 2016 Google Inc.
  16. //
  17. // Licensed under the Apache License, Version 2.0 (the "License");
  18. // you may not use this file except in compliance with the License.
  19. // You may obtain a copy of the License at
  20. //
  21. // http://www.apache.org/licenses/LICENSE-2.0
  22. //
  23. // Unless required by applicable law or agreed to in writing, software
  24. // distributed under the License is distributed on an "AS IS" BASIS,
  25. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  26. // See the License for the specific language governing permissions and
  27. // limitations under the License.
  28. //go:build !linux
  29. // +build !linux
  30. package dhcp
  31. import (
  32. "errors"
  33. "golang.org/x/net/bpf"
  34. )
  35. // NewSnooperConn creates a Conn that listens on the given UDP ip:port.
  36. //
  37. // Unlike NewConn, NewSnooperConn does not bind to the ip:port,
  38. // enabling the Conn to coexist with other services on the machine.
  39. func NewSnooperConn(addr string) (*Conn, error) {
  40. return nil, errors.New("snooper Conns not supported on this OS")
  41. }
  42. func newRawSocketConn(iface string, filter []bpf.RawInstruction, dhcpServerPort uint16) (conn, error) {
  43. return nil, errors.New("raw socket Conns not supported on this OS")
  44. }
  45. func newRawSocketConn6(iface string, filter []bpf.RawInstruction, dhcpServerPort uint16) (conn, error) {
  46. return nil, errors.New("raw IPv6 socket Conns not supported on this OS")
  47. }