mirror of
https://github.com/xjasonlyu/tun2socks.git
synced 2025-10-05 08:47:00 +08:00
Chore: reorder imports
This commit is contained in:
@@ -6,10 +6,10 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
"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"
|
||||||
|
|
||||||
|
"github.com/xjasonlyu/tun2socks/v2/core/device"
|
||||||
)
|
)
|
||||||
|
|
||||||
type FD struct {
|
type FD struct {
|
||||||
|
@@ -3,9 +3,9 @@ package fdbased
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/xjasonlyu/tun2socks/v2/core/device"
|
|
||||||
|
|
||||||
"gvisor.dev/gvisor/pkg/tcpip/link/fdbased"
|
"gvisor.dev/gvisor/pkg/tcpip/link/fdbased"
|
||||||
|
|
||||||
|
"github.com/xjasonlyu/tun2socks/v2/core/device"
|
||||||
)
|
)
|
||||||
|
|
||||||
func open(fd int, mtu uint32) (device.Device, error) {
|
func open(fd int, mtu uint32) (device.Device, error) {
|
||||||
|
@@ -6,13 +6,13 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"unsafe"
|
"unsafe"
|
||||||
|
|
||||||
"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"
|
||||||
"gvisor.dev/gvisor/pkg/tcpip/link/rawfile"
|
"gvisor.dev/gvisor/pkg/tcpip/link/rawfile"
|
||||||
"gvisor.dev/gvisor/pkg/tcpip/link/tun"
|
"gvisor.dev/gvisor/pkg/tcpip/link/tun"
|
||||||
"gvisor.dev/gvisor/pkg/tcpip/stack"
|
"gvisor.dev/gvisor/pkg/tcpip/stack"
|
||||||
|
|
||||||
|
"github.com/xjasonlyu/tun2socks/v2/core/device"
|
||||||
)
|
)
|
||||||
|
|
||||||
type TUN struct {
|
type TUN struct {
|
||||||
|
@@ -5,10 +5,10 @@ package tun
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
|
"golang.zx2c4.com/wireguard/tun"
|
||||||
|
|
||||||
"github.com/xjasonlyu/tun2socks/v2/core/device"
|
"github.com/xjasonlyu/tun2socks/v2/core/device"
|
||||||
"github.com/xjasonlyu/tun2socks/v2/core/device/iobased"
|
"github.com/xjasonlyu/tun2socks/v2/core/device/iobased"
|
||||||
|
|
||||||
"golang.zx2c4.com/wireguard/tun"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type TUN struct {
|
type TUN struct {
|
||||||
|
@@ -3,10 +3,10 @@ package core
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/xjasonlyu/tun2socks/v2/core/option"
|
|
||||||
|
|
||||||
"gvisor.dev/gvisor/pkg/tcpip"
|
"gvisor.dev/gvisor/pkg/tcpip"
|
||||||
"gvisor.dev/gvisor/pkg/tcpip/stack"
|
"gvisor.dev/gvisor/pkg/tcpip/stack"
|
||||||
|
|
||||||
|
"github.com/xjasonlyu/tun2socks/v2/core/option"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@@ -1,11 +1,11 @@
|
|||||||
package core
|
package core
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/xjasonlyu/tun2socks/v2/core/option"
|
|
||||||
|
|
||||||
"gvisor.dev/gvisor/pkg/tcpip"
|
"gvisor.dev/gvisor/pkg/tcpip"
|
||||||
"gvisor.dev/gvisor/pkg/tcpip/header"
|
"gvisor.dev/gvisor/pkg/tcpip/header"
|
||||||
"gvisor.dev/gvisor/pkg/tcpip/stack"
|
"gvisor.dev/gvisor/pkg/tcpip/stack"
|
||||||
|
|
||||||
|
"github.com/xjasonlyu/tun2socks/v2/core/option"
|
||||||
)
|
)
|
||||||
|
|
||||||
func withRouteTable(nicID tcpip.NICID) option.Option {
|
func withRouteTable(nicID tcpip.NICID) option.Option {
|
||||||
|
@@ -1,9 +1,6 @@
|
|||||||
package core
|
package core
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/xjasonlyu/tun2socks/v2/core/adapter"
|
|
||||||
"github.com/xjasonlyu/tun2socks/v2/core/option"
|
|
||||||
|
|
||||||
"gvisor.dev/gvisor/pkg/tcpip"
|
"gvisor.dev/gvisor/pkg/tcpip"
|
||||||
"gvisor.dev/gvisor/pkg/tcpip/network/ipv4"
|
"gvisor.dev/gvisor/pkg/tcpip/network/ipv4"
|
||||||
"gvisor.dev/gvisor/pkg/tcpip/network/ipv6"
|
"gvisor.dev/gvisor/pkg/tcpip/network/ipv6"
|
||||||
@@ -11,6 +8,9 @@ import (
|
|||||||
"gvisor.dev/gvisor/pkg/tcpip/transport/icmp"
|
"gvisor.dev/gvisor/pkg/tcpip/transport/icmp"
|
||||||
"gvisor.dev/gvisor/pkg/tcpip/transport/tcp"
|
"gvisor.dev/gvisor/pkg/tcpip/transport/tcp"
|
||||||
"gvisor.dev/gvisor/pkg/tcpip/transport/udp"
|
"gvisor.dev/gvisor/pkg/tcpip/transport/udp"
|
||||||
|
|
||||||
|
"github.com/xjasonlyu/tun2socks/v2/core/adapter"
|
||||||
|
"github.com/xjasonlyu/tun2socks/v2/core/option"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Config is the configuration to create *stack.Stack.
|
// Config is the configuration to create *stack.Stack.
|
||||||
|
@@ -3,15 +3,15 @@ package core
|
|||||||
import (
|
import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/xjasonlyu/tun2socks/v2/core/adapter"
|
|
||||||
"github.com/xjasonlyu/tun2socks/v2/core/option"
|
|
||||||
|
|
||||||
"gvisor.dev/gvisor/pkg/tcpip"
|
"gvisor.dev/gvisor/pkg/tcpip"
|
||||||
"gvisor.dev/gvisor/pkg/tcpip/adapters/gonet"
|
"gvisor.dev/gvisor/pkg/tcpip/adapters/gonet"
|
||||||
"gvisor.dev/gvisor/pkg/tcpip/header"
|
"gvisor.dev/gvisor/pkg/tcpip/header"
|
||||||
"gvisor.dev/gvisor/pkg/tcpip/stack"
|
"gvisor.dev/gvisor/pkg/tcpip/stack"
|
||||||
"gvisor.dev/gvisor/pkg/tcpip/transport/tcp"
|
"gvisor.dev/gvisor/pkg/tcpip/transport/tcp"
|
||||||
"gvisor.dev/gvisor/pkg/waiter"
|
"gvisor.dev/gvisor/pkg/waiter"
|
||||||
|
|
||||||
|
"github.com/xjasonlyu/tun2socks/v2/core/adapter"
|
||||||
|
"github.com/xjasonlyu/tun2socks/v2/core/option"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@@ -1,13 +1,13 @@
|
|||||||
package core
|
package core
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/xjasonlyu/tun2socks/v2/core/adapter"
|
|
||||||
"github.com/xjasonlyu/tun2socks/v2/core/option"
|
|
||||||
|
|
||||||
"gvisor.dev/gvisor/pkg/tcpip/adapters/gonet"
|
"gvisor.dev/gvisor/pkg/tcpip/adapters/gonet"
|
||||||
"gvisor.dev/gvisor/pkg/tcpip/stack"
|
"gvisor.dev/gvisor/pkg/tcpip/stack"
|
||||||
"gvisor.dev/gvisor/pkg/tcpip/transport/udp"
|
"gvisor.dev/gvisor/pkg/tcpip/transport/udp"
|
||||||
"gvisor.dev/gvisor/pkg/waiter"
|
"gvisor.dev/gvisor/pkg/waiter"
|
||||||
|
|
||||||
|
"github.com/xjasonlyu/tun2socks/v2/core/adapter"
|
||||||
|
"github.com/xjasonlyu/tun2socks/v2/core/option"
|
||||||
)
|
)
|
||||||
|
|
||||||
func withUDPHandler(handle func(adapter.UDPConn), printf func(string, ...any)) option.Option {
|
func withUDPHandler(handle func(adapter.UDPConn), printf func(string, ...any)) option.Option {
|
||||||
|
@@ -7,6 +7,10 @@ import (
|
|||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/docker/go-units"
|
||||||
|
"gvisor.dev/gvisor/pkg/tcpip"
|
||||||
|
"gvisor.dev/gvisor/pkg/tcpip/stack"
|
||||||
|
|
||||||
"github.com/xjasonlyu/tun2socks/v2/component/dialer"
|
"github.com/xjasonlyu/tun2socks/v2/component/dialer"
|
||||||
"github.com/xjasonlyu/tun2socks/v2/core"
|
"github.com/xjasonlyu/tun2socks/v2/core"
|
||||||
"github.com/xjasonlyu/tun2socks/v2/core/device"
|
"github.com/xjasonlyu/tun2socks/v2/core/device"
|
||||||
@@ -16,10 +20,6 @@ import (
|
|||||||
"github.com/xjasonlyu/tun2socks/v2/proxy"
|
"github.com/xjasonlyu/tun2socks/v2/proxy"
|
||||||
"github.com/xjasonlyu/tun2socks/v2/restapi"
|
"github.com/xjasonlyu/tun2socks/v2/restapi"
|
||||||
"github.com/xjasonlyu/tun2socks/v2/tunnel"
|
"github.com/xjasonlyu/tun2socks/v2/tunnel"
|
||||||
|
|
||||||
"github.com/docker/go-units"
|
|
||||||
"gvisor.dev/gvisor/pkg/tcpip"
|
|
||||||
"gvisor.dev/gvisor/pkg/tcpip/stack"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
6
main.go
6
main.go
@@ -7,13 +7,13 @@ import (
|
|||||||
"os/signal"
|
"os/signal"
|
||||||
"syscall"
|
"syscall"
|
||||||
|
|
||||||
|
"go.uber.org/automaxprocs/maxprocs"
|
||||||
|
"gopkg.in/yaml.v3"
|
||||||
|
|
||||||
_ "github.com/xjasonlyu/tun2socks/v2/dns"
|
_ "github.com/xjasonlyu/tun2socks/v2/dns"
|
||||||
"github.com/xjasonlyu/tun2socks/v2/engine"
|
"github.com/xjasonlyu/tun2socks/v2/engine"
|
||||||
"github.com/xjasonlyu/tun2socks/v2/internal/version"
|
"github.com/xjasonlyu/tun2socks/v2/internal/version"
|
||||||
"github.com/xjasonlyu/tun2socks/v2/log"
|
"github.com/xjasonlyu/tun2socks/v2/log"
|
||||||
|
|
||||||
"go.uber.org/automaxprocs/maxprocs"
|
|
||||||
"gopkg.in/yaml.v3"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@@ -6,13 +6,13 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"net"
|
"net"
|
||||||
|
|
||||||
|
"github.com/Dreamacro/go-shadowsocks2/core"
|
||||||
|
|
||||||
"github.com/xjasonlyu/tun2socks/v2/component/dialer"
|
"github.com/xjasonlyu/tun2socks/v2/component/dialer"
|
||||||
obfs "github.com/xjasonlyu/tun2socks/v2/component/simple-obfs"
|
obfs "github.com/xjasonlyu/tun2socks/v2/component/simple-obfs"
|
||||||
M "github.com/xjasonlyu/tun2socks/v2/metadata"
|
M "github.com/xjasonlyu/tun2socks/v2/metadata"
|
||||||
"github.com/xjasonlyu/tun2socks/v2/proxy/proto"
|
"github.com/xjasonlyu/tun2socks/v2/proxy/proto"
|
||||||
"github.com/xjasonlyu/tun2socks/v2/transport/socks5"
|
"github.com/xjasonlyu/tun2socks/v2/transport/socks5"
|
||||||
|
|
||||||
"github.com/Dreamacro/go-shadowsocks2/core"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ Proxy = (*Shadowsocks)(nil)
|
var _ Proxy = (*Shadowsocks)(nil)
|
||||||
|
@@ -7,11 +7,11 @@ import (
|
|||||||
"strconv"
|
"strconv"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"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"
|
||||||
"github.com/gorilla/websocket"
|
"github.com/gorilla/websocket"
|
||||||
|
|
||||||
|
"github.com/xjasonlyu/tun2socks/v2/tunnel/statistic"
|
||||||
)
|
)
|
||||||
|
|
||||||
const defaultInterval = 1000
|
const defaultInterval = 1000
|
||||||
|
@@ -10,14 +10,14 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
V "github.com/xjasonlyu/tun2socks/v2/internal/version"
|
|
||||||
"github.com/xjasonlyu/tun2socks/v2/log"
|
|
||||||
"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"
|
||||||
"github.com/go-chi/render"
|
"github.com/go-chi/render"
|
||||||
"github.com/gorilla/websocket"
|
"github.com/gorilla/websocket"
|
||||||
|
|
||||||
|
V "github.com/xjasonlyu/tun2socks/v2/internal/version"
|
||||||
|
"github.com/xjasonlyu/tun2socks/v2/log"
|
||||||
|
"github.com/xjasonlyu/tun2socks/v2/tunnel/statistic"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@@ -4,10 +4,10 @@ import (
|
|||||||
"net"
|
"net"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
M "github.com/xjasonlyu/tun2socks/v2/metadata"
|
|
||||||
|
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"go.uber.org/atomic"
|
"go.uber.org/atomic"
|
||||||
|
|
||||||
|
M "github.com/xjasonlyu/tun2socks/v2/metadata"
|
||||||
)
|
)
|
||||||
|
|
||||||
type tracker interface {
|
type tracker interface {
|
||||||
|
Reference in New Issue
Block a user