tun_unsupported.go 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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. )
  26. const (
  27. DEFAULT_PUBLIC_INTERFACE_NAME = ""
  28. )
  29. func IsSupported() bool {
  30. return false
  31. }
  32. func makeDeviceInboundBuffer(_ int) []byte {
  33. return nil
  34. }
  35. func makeDeviceOutboundBuffer(_ int) []byte {
  36. return nil
  37. }
  38. func OpenTunDevice(_ string) (*os.File, string, error) {
  39. return nil, "", common.ContextError(unsupportedError)
  40. }
  41. func (device *Device) readTunPacket() (int, int, error) {
  42. return 0, 0, common.ContextError(unsupportedError)
  43. }
  44. func (device *Device) writeTunPacket(_ []byte) error {
  45. return common.ContextError(unsupportedError)
  46. }
  47. func configureNetworkConfigSubprocessCapabilities() error {
  48. return common.ContextError(unsupportedError)
  49. }
  50. func resetNATTables(_ *ServerConfig, _ net.IP) error {
  51. return common.ContextError(unsupportedError)
  52. }
  53. func configureServerInterface(_ *ServerConfig, _ string) error {
  54. return common.ContextError(unsupportedError)
  55. }
  56. func configureClientInterface(_ *ClientConfig, _ string) error {
  57. return common.ContextError(unsupportedError)
  58. }
  59. func BindToDevice(_ int, _ string) error {
  60. return common.ContextError(unsupportedError)
  61. }
  62. func fixBindToDevice(_ common.Logger, _ bool, _ string) error {
  63. // Not required
  64. return nil
  65. }
  66. type NonblockingIO struct {
  67. }
  68. func NewNonblockingIO(ioFD int) (*NonblockingIO, error) {
  69. return nil, common.ContextError(unsupportedError)
  70. }
  71. func (nio *NonblockingIO) Read(p []byte) (int, error) {
  72. return 0, common.ContextError(unsupportedError)
  73. }
  74. func (nio *NonblockingIO) Write(p []byte) (int, error) {
  75. return 0, common.ContextError(unsupportedError)
  76. }
  77. func (nio *NonblockingIO) IsClosed() bool {
  78. return false
  79. }
  80. func (nio *NonblockingIO) Close() error {
  81. return common.ContextError(unsupportedError)
  82. }