net_other.go 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. //go:build !darwin && !android && !linux && !windows
  2. // +build !darwin,!android,!linux,!windows
  3. /*
  4. * Copyright (c) 2017, Psiphon Inc.
  5. * All rights reserved.
  6. *
  7. * This program is free software: you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation, either version 3 of the License, or
  10. * (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  19. *
  20. */
  21. package psiphon
  22. import (
  23. "net"
  24. "strconv"
  25. "github.com/Psiphon-Labs/psiphon-tunnel-core/psiphon/common/errors"
  26. "golang.org/x/net/bpf"
  27. )
  28. func ClientBPFEnabled() bool {
  29. return false
  30. }
  31. func setSocketBPF(_ []bpf.RawInstruction, _ int) error {
  32. return errors.TraceNew("BPF not supported")
  33. }
  34. func setAdditionalSocketOptions(_ int) {
  35. }
  36. func makeLocalProxyListener(listenIP string, port int) (net.Listener, bool, error) {
  37. listener, err := net.Listen("tcp", net.JoinHostPort(listenIP, strconv.Itoa(port)))
  38. if err != nil {
  39. return nil, IsAddressInUseError(err), errors.Trace(err)
  40. }
  41. return listener, false, nil
  42. }