mirror of
https://github.com/xjasonlyu/tun2socks.git
synced 2025-10-06 09:16:58 +08:00
Fix: set major version to v2 (#88)
This commit is contained in:
2
Makefile
2
Makefile
@@ -1,5 +1,5 @@
|
|||||||
BINARY := tun2socks
|
BINARY := tun2socks
|
||||||
MODULE := github.com/xjasonlyu/tun2socks
|
MODULE := github.com/xjasonlyu/tun2socks/v2
|
||||||
|
|
||||||
BUILD_DIR := build
|
BUILD_DIR := build
|
||||||
BUILD_TAGS :=
|
BUILD_TAGS :=
|
||||||
|
@@ -9,7 +9,7 @@ import (
|
|||||||
"net"
|
"net"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"github.com/xjasonlyu/tun2socks/common/pool"
|
"github.com/xjasonlyu/tun2socks/v2/common/pool"
|
||||||
)
|
)
|
||||||
|
|
||||||
// HTTPObfs is shadowsocks http simple-obfs implementation
|
// HTTPObfs is shadowsocks http simple-obfs implementation
|
||||||
|
@@ -8,7 +8,7 @@ import (
|
|||||||
"net"
|
"net"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/xjasonlyu/tun2socks/common/pool"
|
"github.com/xjasonlyu/tun2socks/v2/common/pool"
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
@@ -7,7 +7,7 @@ import (
|
|||||||
"net"
|
"net"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
"github.com/xjasonlyu/tun2socks/transport/socks5"
|
"github.com/xjasonlyu/tun2socks/v2/transport/socks5"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@@ -6,7 +6,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
"github.com/xjasonlyu/tun2socks/core/device"
|
"github.com/xjasonlyu/tun2socks/v2/core/device"
|
||||||
"golang.org/x/sys/unix"
|
"golang.org/x/sys/unix"
|
||||||
"gvisor.dev/gvisor/pkg/tcpip/stack"
|
"gvisor.dev/gvisor/pkg/tcpip/stack"
|
||||||
)
|
)
|
||||||
|
@@ -3,7 +3,7 @@ package fd
|
|||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
|
|
||||||
"github.com/xjasonlyu/tun2socks/core/device"
|
"github.com/xjasonlyu/tun2socks/v2/core/device"
|
||||||
)
|
)
|
||||||
|
|
||||||
func Open(name string, mtu uint32) (device.Device, error) {
|
func Open(name string, mtu uint32) (device.Device, error) {
|
||||||
|
@@ -3,7 +3,7 @@ package fd
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/xjasonlyu/tun2socks/core/device"
|
"github.com/xjasonlyu/tun2socks/v2/core/device"
|
||||||
"gvisor.dev/gvisor/pkg/tcpip/link/fdbased"
|
"gvisor.dev/gvisor/pkg/tcpip/link/fdbased"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@@ -6,8 +6,8 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"github.com/xjasonlyu/tun2socks/core/device"
|
"github.com/xjasonlyu/tun2socks/v2/core/device"
|
||||||
"github.com/xjasonlyu/tun2socks/core/device/rwbased"
|
"github.com/xjasonlyu/tun2socks/v2/core/device/rwbased"
|
||||||
)
|
)
|
||||||
|
|
||||||
func open(fd int, mtu uint32) (device.Device, error) {
|
func open(fd int, mtu uint32) (device.Device, error) {
|
||||||
|
@@ -3,7 +3,7 @@
|
|||||||
package tun
|
package tun
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/xjasonlyu/tun2socks/common/pool"
|
"github.com/xjasonlyu/tun2socks/v2/common/pool"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
package tun
|
package tun
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/xjasonlyu/tun2socks/core/device"
|
"github.com/xjasonlyu/tun2socks/v2/core/device"
|
||||||
)
|
)
|
||||||
|
|
||||||
const Driver = "tun"
|
const Driver = "tun"
|
||||||
|
@@ -6,7 +6,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"unsafe"
|
"unsafe"
|
||||||
|
|
||||||
"github.com/xjasonlyu/tun2socks/core/device"
|
"github.com/xjasonlyu/tun2socks/v2/core/device"
|
||||||
|
|
||||||
"golang.org/x/sys/unix"
|
"golang.org/x/sys/unix"
|
||||||
"gvisor.dev/gvisor/pkg/tcpip/link/fdbased"
|
"gvisor.dev/gvisor/pkg/tcpip/link/fdbased"
|
||||||
|
@@ -5,8 +5,8 @@ package tun
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/xjasonlyu/tun2socks/core/device"
|
"github.com/xjasonlyu/tun2socks/v2/core/device"
|
||||||
"github.com/xjasonlyu/tun2socks/core/device/rwbased"
|
"github.com/xjasonlyu/tun2socks/v2/core/device/rwbased"
|
||||||
|
|
||||||
"golang.zx2c4.com/wireguard/tun"
|
"golang.zx2c4.com/wireguard/tun"
|
||||||
)
|
)
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
package stack
|
package stack
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/xjasonlyu/tun2socks/core"
|
"github.com/xjasonlyu/tun2socks/v2/core"
|
||||||
|
|
||||||
"gvisor.dev/gvisor/pkg/tcpip"
|
"gvisor.dev/gvisor/pkg/tcpip"
|
||||||
"gvisor.dev/gvisor/pkg/tcpip/network/ipv4"
|
"gvisor.dev/gvisor/pkg/tcpip/network/ipv4"
|
||||||
|
@@ -4,13 +4,13 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"github.com/xjasonlyu/tun2socks/component/dialer"
|
"github.com/xjasonlyu/tun2socks/v2/component/dialer"
|
||||||
"github.com/xjasonlyu/tun2socks/core/device"
|
"github.com/xjasonlyu/tun2socks/v2/core/device"
|
||||||
"github.com/xjasonlyu/tun2socks/core/stack"
|
"github.com/xjasonlyu/tun2socks/v2/core/stack"
|
||||||
"github.com/xjasonlyu/tun2socks/log"
|
"github.com/xjasonlyu/tun2socks/v2/log"
|
||||||
"github.com/xjasonlyu/tun2socks/proxy"
|
"github.com/xjasonlyu/tun2socks/v2/proxy"
|
||||||
"github.com/xjasonlyu/tun2socks/stats"
|
"github.com/xjasonlyu/tun2socks/v2/stats"
|
||||||
"github.com/xjasonlyu/tun2socks/tunnel"
|
"github.com/xjasonlyu/tun2socks/v2/tunnel"
|
||||||
|
|
||||||
"gopkg.in/yaml.v3"
|
"gopkg.in/yaml.v3"
|
||||||
)
|
)
|
||||||
|
@@ -6,11 +6,11 @@ import (
|
|||||||
"net/url"
|
"net/url"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/xjasonlyu/tun2socks/core/device"
|
"github.com/xjasonlyu/tun2socks/v2/core/device"
|
||||||
"github.com/xjasonlyu/tun2socks/core/device/fd"
|
"github.com/xjasonlyu/tun2socks/v2/core/device/fd"
|
||||||
"github.com/xjasonlyu/tun2socks/core/device/tun"
|
"github.com/xjasonlyu/tun2socks/v2/core/device/tun"
|
||||||
"github.com/xjasonlyu/tun2socks/proxy"
|
"github.com/xjasonlyu/tun2socks/v2/proxy"
|
||||||
"github.com/xjasonlyu/tun2socks/proxy/proto"
|
"github.com/xjasonlyu/tun2socks/v2/proxy/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
func parseDevice(s string, mtu uint32) (device.Device, error) {
|
func parseDevice(s string, mtu uint32) (device.Device, error) {
|
||||||
|
@@ -1,8 +1,8 @@
|
|||||||
package engine
|
package engine
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/xjasonlyu/tun2socks/core"
|
"github.com/xjasonlyu/tun2socks/v2/core"
|
||||||
"github.com/xjasonlyu/tun2socks/tunnel"
|
"github.com/xjasonlyu/tun2socks/v2/tunnel"
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ core.Handler = (*fakeTunnel)(nil)
|
var _ core.Handler = (*fakeTunnel)(nil)
|
||||||
|
@@ -5,7 +5,7 @@ import (
|
|||||||
"runtime"
|
"runtime"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
V "github.com/xjasonlyu/tun2socks/constant"
|
V "github.com/xjasonlyu/tun2socks/v2/constant"
|
||||||
)
|
)
|
||||||
|
|
||||||
func showVersion() {
|
func showVersion() {
|
||||||
|
2
go.mod
2
go.mod
@@ -1,4 +1,4 @@
|
|||||||
module github.com/xjasonlyu/tun2socks
|
module github.com/xjasonlyu/tun2socks/v2
|
||||||
|
|
||||||
go 1.17
|
go 1.17
|
||||||
|
|
||||||
|
@@ -4,7 +4,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/xjasonlyu/tun2socks/common/observable"
|
"github.com/xjasonlyu/tun2socks/v2/common/observable"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
4
main.go
4
main.go
@@ -6,8 +6,8 @@ import (
|
|||||||
"os/signal"
|
"os/signal"
|
||||||
"syscall"
|
"syscall"
|
||||||
|
|
||||||
"github.com/xjasonlyu/tun2socks/engine"
|
"github.com/xjasonlyu/tun2socks/v2/engine"
|
||||||
"github.com/xjasonlyu/tun2socks/log"
|
"github.com/xjasonlyu/tun2socks/v2/log"
|
||||||
)
|
)
|
||||||
|
|
||||||
var key = new(engine.Key)
|
var key = new(engine.Key)
|
||||||
|
@@ -5,8 +5,8 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"net"
|
"net"
|
||||||
|
|
||||||
M "github.com/xjasonlyu/tun2socks/constant"
|
M "github.com/xjasonlyu/tun2socks/v2/constant"
|
||||||
"github.com/xjasonlyu/tun2socks/proxy/proto"
|
"github.com/xjasonlyu/tun2socks/v2/proxy/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ Proxy = (*Base)(nil)
|
var _ Proxy = (*Base)(nil)
|
||||||
|
@@ -4,9 +4,9 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"net"
|
"net"
|
||||||
|
|
||||||
"github.com/xjasonlyu/tun2socks/component/dialer"
|
"github.com/xjasonlyu/tun2socks/v2/component/dialer"
|
||||||
M "github.com/xjasonlyu/tun2socks/constant"
|
M "github.com/xjasonlyu/tun2socks/v2/constant"
|
||||||
"github.com/xjasonlyu/tun2socks/proxy/proto"
|
"github.com/xjasonlyu/tun2socks/v2/proxy/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ Proxy = (*Direct)(nil)
|
var _ Proxy = (*Direct)(nil)
|
||||||
|
@@ -13,9 +13,9 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
|
|
||||||
"github.com/xjasonlyu/tun2socks/component/dialer"
|
"github.com/xjasonlyu/tun2socks/v2/component/dialer"
|
||||||
M "github.com/xjasonlyu/tun2socks/constant"
|
M "github.com/xjasonlyu/tun2socks/v2/constant"
|
||||||
"github.com/xjasonlyu/tun2socks/proxy/proto"
|
"github.com/xjasonlyu/tun2socks/v2/proxy/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
type HTTP struct {
|
type HTTP struct {
|
||||||
|
@@ -6,8 +6,8 @@ import (
|
|||||||
"net"
|
"net"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
M "github.com/xjasonlyu/tun2socks/constant"
|
M "github.com/xjasonlyu/tun2socks/v2/constant"
|
||||||
"github.com/xjasonlyu/tun2socks/proxy/proto"
|
"github.com/xjasonlyu/tun2socks/v2/proxy/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@@ -6,8 +6,8 @@ import (
|
|||||||
"net"
|
"net"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
M "github.com/xjasonlyu/tun2socks/constant"
|
M "github.com/xjasonlyu/tun2socks/v2/constant"
|
||||||
"github.com/xjasonlyu/tun2socks/proxy/proto"
|
"github.com/xjasonlyu/tun2socks/v2/proxy/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ Proxy = (*Reject)(nil)
|
var _ Proxy = (*Reject)(nil)
|
||||||
|
@@ -6,11 +6,11 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"net"
|
"net"
|
||||||
|
|
||||||
"github.com/xjasonlyu/tun2socks/component/dialer"
|
"github.com/xjasonlyu/tun2socks/v2/component/dialer"
|
||||||
obfs "github.com/xjasonlyu/tun2socks/component/simple-obfs"
|
obfs "github.com/xjasonlyu/tun2socks/v2/component/simple-obfs"
|
||||||
M "github.com/xjasonlyu/tun2socks/constant"
|
M "github.com/xjasonlyu/tun2socks/v2/constant"
|
||||||
"github.com/xjasonlyu/tun2socks/proxy/proto"
|
"github.com/xjasonlyu/tun2socks/v2/proxy/proto"
|
||||||
"github.com/xjasonlyu/tun2socks/transport/socks5"
|
"github.com/xjasonlyu/tun2socks/v2/transport/socks5"
|
||||||
|
|
||||||
"github.com/Dreamacro/go-shadowsocks2/core"
|
"github.com/Dreamacro/go-shadowsocks2/core"
|
||||||
)
|
)
|
||||||
|
@@ -5,10 +5,10 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"net"
|
"net"
|
||||||
|
|
||||||
"github.com/xjasonlyu/tun2socks/component/dialer"
|
"github.com/xjasonlyu/tun2socks/v2/component/dialer"
|
||||||
M "github.com/xjasonlyu/tun2socks/constant"
|
M "github.com/xjasonlyu/tun2socks/v2/constant"
|
||||||
"github.com/xjasonlyu/tun2socks/proxy/proto"
|
"github.com/xjasonlyu/tun2socks/v2/proxy/proto"
|
||||||
"github.com/xjasonlyu/tun2socks/transport/socks4"
|
"github.com/xjasonlyu/tun2socks/v2/transport/socks4"
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ Proxy = (*Socks4)(nil)
|
var _ Proxy = (*Socks4)(nil)
|
||||||
|
@@ -7,10 +7,10 @@ import (
|
|||||||
"io"
|
"io"
|
||||||
"net"
|
"net"
|
||||||
|
|
||||||
"github.com/xjasonlyu/tun2socks/component/dialer"
|
"github.com/xjasonlyu/tun2socks/v2/component/dialer"
|
||||||
M "github.com/xjasonlyu/tun2socks/constant"
|
M "github.com/xjasonlyu/tun2socks/v2/constant"
|
||||||
"github.com/xjasonlyu/tun2socks/proxy/proto"
|
"github.com/xjasonlyu/tun2socks/v2/proxy/proto"
|
||||||
"github.com/xjasonlyu/tun2socks/transport/socks5"
|
"github.com/xjasonlyu/tun2socks/v2/transport/socks5"
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ Proxy = (*Socks5)(nil)
|
var _ Proxy = (*Socks5)(nil)
|
||||||
|
@@ -7,7 +7,7 @@ import (
|
|||||||
"strconv"
|
"strconv"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/xjasonlyu/tun2socks/tunnel/statistic"
|
"github.com/xjasonlyu/tun2socks/v2/tunnel/statistic"
|
||||||
|
|
||||||
"github.com/go-chi/chi/v5"
|
"github.com/go-chi/chi/v5"
|
||||||
"github.com/go-chi/render"
|
"github.com/go-chi/render"
|
||||||
|
@@ -8,9 +8,9 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
V "github.com/xjasonlyu/tun2socks/constant"
|
V "github.com/xjasonlyu/tun2socks/v2/constant"
|
||||||
"github.com/xjasonlyu/tun2socks/log"
|
"github.com/xjasonlyu/tun2socks/v2/log"
|
||||||
"github.com/xjasonlyu/tun2socks/tunnel/statistic"
|
"github.com/xjasonlyu/tun2socks/v2/tunnel/statistic"
|
||||||
|
|
||||||
"github.com/go-chi/chi/v5"
|
"github.com/go-chi/chi/v5"
|
||||||
"github.com/go-chi/cors"
|
"github.com/go-chi/cors"
|
||||||
|
@@ -4,7 +4,7 @@ import (
|
|||||||
"net"
|
"net"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
M "github.com/xjasonlyu/tun2socks/constant"
|
M "github.com/xjasonlyu/tun2socks/v2/constant"
|
||||||
|
|
||||||
"github.com/gofrs/uuid"
|
"github.com/gofrs/uuid"
|
||||||
"go.uber.org/atomic"
|
"go.uber.org/atomic"
|
||||||
|
@@ -6,12 +6,12 @@ import (
|
|||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/xjasonlyu/tun2socks/common/pool"
|
"github.com/xjasonlyu/tun2socks/v2/common/pool"
|
||||||
M "github.com/xjasonlyu/tun2socks/constant"
|
M "github.com/xjasonlyu/tun2socks/v2/constant"
|
||||||
"github.com/xjasonlyu/tun2socks/core"
|
"github.com/xjasonlyu/tun2socks/v2/core"
|
||||||
"github.com/xjasonlyu/tun2socks/log"
|
"github.com/xjasonlyu/tun2socks/v2/log"
|
||||||
"github.com/xjasonlyu/tun2socks/proxy"
|
"github.com/xjasonlyu/tun2socks/v2/proxy"
|
||||||
"github.com/xjasonlyu/tun2socks/tunnel/statistic"
|
"github.com/xjasonlyu/tun2socks/v2/tunnel/statistic"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@@ -3,8 +3,8 @@ package tunnel
|
|||||||
import (
|
import (
|
||||||
"runtime"
|
"runtime"
|
||||||
|
|
||||||
"github.com/xjasonlyu/tun2socks/core"
|
"github.com/xjasonlyu/tun2socks/v2/core"
|
||||||
"github.com/xjasonlyu/tun2socks/log"
|
"github.com/xjasonlyu/tun2socks/v2/log"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@@ -6,13 +6,13 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/xjasonlyu/tun2socks/common/pool"
|
"github.com/xjasonlyu/tun2socks/v2/common/pool"
|
||||||
"github.com/xjasonlyu/tun2socks/component/nat"
|
"github.com/xjasonlyu/tun2socks/v2/component/nat"
|
||||||
M "github.com/xjasonlyu/tun2socks/constant"
|
M "github.com/xjasonlyu/tun2socks/v2/constant"
|
||||||
"github.com/xjasonlyu/tun2socks/core"
|
"github.com/xjasonlyu/tun2socks/v2/core"
|
||||||
"github.com/xjasonlyu/tun2socks/log"
|
"github.com/xjasonlyu/tun2socks/v2/log"
|
||||||
"github.com/xjasonlyu/tun2socks/proxy"
|
"github.com/xjasonlyu/tun2socks/v2/proxy"
|
||||||
"github.com/xjasonlyu/tun2socks/tunnel/statistic"
|
"github.com/xjasonlyu/tun2socks/v2/tunnel/statistic"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
Reference in New Issue
Block a user