tun_unsupported.go 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. // +build !darwin,!linux
  2. /*
  3. * Copyright (c) 2017, Psiphon Inc.
  4. * All rights reserved.
  5. *
  6. * This program is free software: you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation, either version 3 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  18. *
  19. */
  20. package tun
  21. import (
  22. "net"
  23. "os"
  24. "github.com/Psiphon-Labs/psiphon-tunnel-core/psiphon/common"
  25. "github.com/Psiphon-Labs/psiphon-tunnel-core/psiphon/common/errors"
  26. )
  27. const (
  28. DEFAULT_PUBLIC_INTERFACE_NAME = ""
  29. )
  30. func IsSupported() bool {
  31. return false
  32. }
  33. func makeDeviceInboundBuffer(_ int) []byte {
  34. return nil
  35. }
  36. func makeDeviceOutboundBuffer(_ int) []byte {
  37. return nil
  38. }
  39. func OpenTunDevice(_ string) (*os.File, string, error) {
  40. return nil, "", errors.Trace(errUnsupported)
  41. }
  42. func (device *Device) readTunPacket() (int, int, error) {
  43. return 0, 0, errors.Trace(errUnsupported)
  44. }
  45. func (device *Device) writeTunPacket(_ []byte) error {
  46. return errors.Trace(errUnsupported)
  47. }
  48. func configureNetworkConfigSubprocessCapabilities() error {
  49. return errors.Trace(errUnsupported)
  50. }
  51. func resetNATTables(_ *ServerConfig, _ net.IP) error {
  52. return errors.Trace(errUnsupported)
  53. }
  54. func configureServerInterface(_ *ServerConfig, _ string) error {
  55. return errors.Trace(errUnsupported)
  56. }
  57. func configureClientInterface(_ *ClientConfig, _ string) error {
  58. return errors.Trace(errUnsupported)
  59. }
  60. func BindToDevice(_ int, _ string) error {
  61. return errors.Trace(errUnsupported)
  62. }
  63. func fixBindToDevice(_ common.Logger, _ bool, _ string) error {
  64. // Not required
  65. return nil
  66. }
  67. type NonblockingIO struct {
  68. }
  69. func NewNonblockingIO(ioFD int) (*NonblockingIO, error) {
  70. return nil, errors.Trace(errUnsupported)
  71. }
  72. func (nio *NonblockingIO) Read(p []byte) (int, error) {
  73. return 0, errors.Trace(errUnsupported)
  74. }
  75. func (nio *NonblockingIO) Write(p []byte) (int, error) {
  76. return 0, errors.Trace(errUnsupported)
  77. }
  78. func (nio *NonblockingIO) IsClosed() bool {
  79. return false
  80. }
  81. func (nio *NonblockingIO) Close() error {
  82. return errors.Trace(errUnsupported)
  83. }