[ Cmii ] [ Octopus ] - project a lot
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
package socks5
|
||||
package main
|
||||
|
||||
import (
|
||||
"errors"
|
||||
|
||||
2
socks5_txthinking/build_all.ps1
Normal file
2
socks5_txthinking/build_all.ps1
Normal file
@@ -0,0 +1,2 @@
|
||||
C:\Users\wddsh\go\bin\gox.exe -osarch="linux/amd64 linux/arm64" -output "build/socks5_{{.OS}}_{{.Arch}}"
|
||||
C:\Users\wddsh\go\bin\gox.exe -osarch="windows/amd64" -output "build/socks5_win64"
|
||||
@@ -1,4 +1,4 @@
|
||||
package socks5
|
||||
package main
|
||||
|
||||
import (
|
||||
"errors"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package socks5
|
||||
package main
|
||||
|
||||
import (
|
||||
"errors"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package socks5
|
||||
package main
|
||||
|
||||
import (
|
||||
"io"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package socks5
|
||||
package main
|
||||
|
||||
import (
|
||||
"encoding/hex"
|
||||
@@ -6,23 +6,28 @@ import (
|
||||
"log"
|
||||
"net"
|
||||
"net/http"
|
||||
"testing"
|
||||
|
||||
"github.com/miekg/dns"
|
||||
)
|
||||
|
||||
func ExampleServer() {
|
||||
s, err := NewClassicServer("127.0.0.1:1080", "127.0.0.1", "", "", 0, 60)
|
||||
func TestNewClassicServer(t *testing.T) {
|
||||
s, err := NewClassicServer(":9997", "0.0.0.0", "", "", 0, 60)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
// You can pass in custom Handler
|
||||
s.ListenAndServe(nil)
|
||||
err = s.ListenAndServe(nil)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
// #Output:
|
||||
}
|
||||
|
||||
func ExampleClient_tcp() {
|
||||
go ExampleServer()
|
||||
//go TestNewClassicServer()
|
||||
c, err := NewClient("127.0.0.1:1080", "", "", 0, 60)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
@@ -51,7 +56,7 @@ func ExampleClient_tcp() {
|
||||
}
|
||||
|
||||
func ExampleClient_udp() {
|
||||
go ExampleServer()
|
||||
//go ExampleServer()
|
||||
c, err := NewClient("127.0.0.1:1080", "", "", 0, 60)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
|
||||
@@ -6,3 +6,10 @@ require (
|
||||
github.com/miekg/dns v1.1.51
|
||||
github.com/patrickmn/go-cache v2.1.0+incompatible
|
||||
)
|
||||
|
||||
require (
|
||||
golang.org/x/mod v0.7.0 // indirect
|
||||
golang.org/x/net v0.2.0 // indirect
|
||||
golang.org/x/sys v0.2.0 // indirect
|
||||
golang.org/x/tools v0.3.0 // indirect
|
||||
)
|
||||
|
||||
@@ -2,8 +2,6 @@ github.com/miekg/dns v1.1.51 h1:0+Xg7vObnhrz/4ZCZcZh7zPXlmU0aveS2HDBd0m0qSo=
|
||||
github.com/miekg/dns v1.1.51/go.mod h1:2Z9d3CP1LQWihRZUf29mQ19yDThaI4DAYzte2CaQW5c=
|
||||
github.com/patrickmn/go-cache v2.1.0+incompatible h1:HRMgzkcYKYpi3C8ajMPV8OFXaaRUnok+kx1WdO15EQc=
|
||||
github.com/patrickmn/go-cache v2.1.0+incompatible/go.mod h1:3Qf8kWWT7OJRJbdiICTKqZju1ZixQ/KpMGzzAfe6+WQ=
|
||||
github.com/txthinking/runnergroup v0.0.0-20210608031112-152c7c4432bf h1:7PflaKRtU4np/epFxRXlFhlzLXZzKFrH5/I4so5Ove0=
|
||||
github.com/txthinking/runnergroup v0.0.0-20210608031112-152c7c4432bf/go.mod h1:CLUSJbazqETbaR+i0YAhXBICV9TrKH93pziccMhmhpM=
|
||||
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package socks5
|
||||
package main
|
||||
|
||||
import (
|
||||
"net"
|
||||
|
||||
@@ -1,5 +1,38 @@
|
||||
package socks5
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
)
|
||||
|
||||
func main() {
|
||||
if len(os.Args) < 2 {
|
||||
fmt.Println("start socks5 server error must provide listen port !")
|
||||
return
|
||||
}
|
||||
if len(os.Args) > 3 {
|
||||
fmt.Println("start socks5 server error !")
|
||||
return
|
||||
}
|
||||
username := ""
|
||||
password := ""
|
||||
if len(os.Args) == 4 {
|
||||
username = os.Args[2]
|
||||
password = os.Args[3]
|
||||
}
|
||||
|
||||
port := os.Args[1]
|
||||
|
||||
s, err := NewClassicServer(":"+port, "0.0.0.0", username, password, 0, 60)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
// You can pass in custom Handler
|
||||
err = s.ListenAndServe(nil)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package main
|
||||
package old_tcp_tailscale
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package socks5
|
||||
package main
|
||||
|
||||
import (
|
||||
"sync"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package socks5
|
||||
package main
|
||||
|
||||
import (
|
||||
"errors"
|
||||
@@ -241,6 +241,7 @@ func (s *Server) ListenAndServe(h Handler) error {
|
||||
return s.UDPConn.Close()
|
||||
},
|
||||
})
|
||||
|
||||
return s.RunnerGroup.Wait()
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package socks5
|
||||
package main
|
||||
|
||||
import (
|
||||
"errors"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package socks5
|
||||
package main
|
||||
|
||||
const (
|
||||
// Ver is socks protocol version
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package socks5
|
||||
package main
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package socks5
|
||||
package main
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package socks5
|
||||
package main
|
||||
|
||||
import "testing"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user