update module path

This commit is contained in:
kayos@tcp.direct 2022-10-16 18:36:23 -07:00
parent 0fc8789cfa
commit 0dc7a7dffc
Signed by: kayos
GPG Key ID: 4B841471B4BEE979
18 changed files with 39 additions and 31 deletions

View File

@ -3,7 +3,7 @@ package main
import (
"time"
"github.com/thinkgos/go-socks5/ccsocks5"
"git.tcp.direct/kayos/go-socks5/ccsocks5"
)
func main() {

View File

@ -4,7 +4,7 @@ import (
"log"
"os"
"github.com/thinkgos/go-socks5"
"git.tcp.direct/kayos/go-socks5"
)
func main() {

View File

@ -7,8 +7,8 @@ import (
"os"
"time"
"github.com/thinkgos/go-socks5"
"github.com/thinkgos/go-socks5/ccsocks5"
"git.tcp.direct/kayos/go-socks5"
"git.tcp.direct/kayos/go-socks5/ccsocks5"
)
func handleErr(err error) {

View File

@ -7,8 +7,8 @@ import (
"os"
"time"
"github.com/thinkgos/go-socks5"
"github.com/thinkgos/go-socks5/ccsocks5"
"git.tcp.direct/kayos/go-socks5"
"git.tcp.direct/kayos/go-socks5/ccsocks5"
)
func handleErr(err error) {

View File

@ -3,7 +3,7 @@ package socks5
import (
"io"
"github.com/thinkgos/go-socks5/statute"
"git.tcp.direct/kayos/go-socks5/statute"
)
// AuthContext A Request encapsulates authentication state provided

View File

@ -8,7 +8,7 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/thinkgos/go-socks5/statute"
"git.tcp.direct/kayos/go-socks5/statute"
)
func TestNoAuth(t *testing.T) {

View File

@ -7,8 +7,8 @@ import (
"golang.org/x/net/proxy"
"github.com/thinkgos/go-socks5/bufferpool"
"github.com/thinkgos/go-socks5/statute"
"git.tcp.direct/kayos/go-socks5/bufferpool"
"git.tcp.direct/kayos/go-socks5/statute"
)
// Client is socks5 client.

View File

@ -3,7 +3,7 @@ package ccsocks5
import (
"golang.org/x/net/proxy"
"github.com/thinkgos/go-socks5/bufferpool"
"git.tcp.direct/kayos/go-socks5/bufferpool"
)
// Option user's option of the client

View File

@ -3,8 +3,8 @@ package ccsocks5
import (
"net"
"github.com/thinkgos/go-socks5/bufferpool"
"github.com/thinkgos/go-socks5/statute"
"git.tcp.direct/kayos/go-socks5/bufferpool"
"git.tcp.direct/kayos/go-socks5/statute"
)
// underConnect under connect

6
go.mod
View File

@ -1,8 +1,8 @@
module github.com/thinkgos/go-socks5
module git.tcp.direct/kayos/go-socks5
go 1.14
go 1.19
require (
github.com/stretchr/testify v1.6.1
golang.org/x/net v0.0.0-20210614182718-04defd469f4e
golang.org/x/net latest
)

View File

@ -8,7 +8,7 @@ import (
"strings"
"sync"
"github.com/thinkgos/go-socks5/statute"
"git.tcp.direct/kayos/go-socks5/statute"
)
// AddressRewriter is used to rewrite a destination transparently
@ -108,10 +108,13 @@ func (sf *Server) handleRequest(write io.Writer, req *Request) error {
func (sf *Server) handleConnect(ctx context.Context, writer io.Writer, request *Request) error {
// Attempt to connect
dial := sf.dial
select {
case <-ctx.Done():
return ctx.Err()
default:
}
if dial == nil {
dial = func(ctx context.Context, net_, addr string) (net.Conn, error) {
return net.Dial(net_, addr)
}
dial = func(ctx context.Context, net_, addr string) (net.Conn, error) { return net.Dial(net_, addr) }
}
target, err := dial(ctx, "tcp", request.DestAddr.String())
if err != nil {
@ -140,6 +143,11 @@ func (sf *Server) handleConnect(ctx context.Context, writer io.Writer, request *
sf.goFunc(func() { errCh <- sf.Proxy(writer, target) })
// Wait
for i := 0; i < 2; i++ {
select {
case <-ctx.Done():
return ctx.Err()
default:
}
e := <-errCh
if e != nil {
// return from this function closes target (and conn).

View File

@ -10,8 +10,8 @@ import (
"github.com/stretchr/testify/require"
"github.com/thinkgos/go-socks5/bufferpool"
"github.com/thinkgos/go-socks5/statute"
"git.tcp.direct/kayos/go-socks5/bufferpool"
"git.tcp.direct/kayos/go-socks5/statute"
)
type MockConn struct {

View File

@ -5,7 +5,7 @@ import (
"io"
"net"
"github.com/thinkgos/go-socks5/bufferpool"
"git.tcp.direct/kayos/go-socks5/bufferpool"
)
// Option user's option

View File

@ -3,7 +3,7 @@ package socks5
import (
"context"
"github.com/thinkgos/go-socks5/statute"
"git.tcp.direct/kayos/go-socks5/statute"
)
// RuleSet is used to provide custom rules to allow or prohibit actions

View File

@ -6,7 +6,7 @@ import (
"github.com/stretchr/testify/require"
"github.com/thinkgos/go-socks5/statute"
"git.tcp.direct/kayos/go-socks5/statute"
)
func TestPermitCommand(t *testing.T) {

View File

@ -10,8 +10,8 @@ import (
"log"
"net"
"github.com/thinkgos/go-socks5/bufferpool"
"github.com/thinkgos/go-socks5/statute"
"git.tcp.direct/kayos/go-socks5/bufferpool"
"git.tcp.direct/kayos/go-socks5/statute"
)
// GPool is used to implement custom goroutine pool default use goroutine

View File

@ -14,7 +14,7 @@ import (
"github.com/stretchr/testify/require"
"golang.org/x/net/proxy"
"github.com/thinkgos/go-socks5/statute"
"git.tcp.direct/kayos/go-socks5/statute"
)
func TestSOCKS5_Connect(t *testing.T) {

View File

@ -12,9 +12,9 @@ import (
"github.com/stretchr/testify/require"
"golang.org/x/net/proxy"
"github.com/thinkgos/go-socks5"
"github.com/thinkgos/go-socks5/bufferpool"
"github.com/thinkgos/go-socks5/ccsocks5"
"git.tcp.direct/kayos/go-socks5"
"git.tcp.direct/kayos/go-socks5/bufferpool"
"git.tcp.direct/kayos/go-socks5/ccsocks5"
)
func Test_Socks5_Connect(t *testing.T) {