Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: CI

on:
pull_request:
branches:
- master
push:
branches:
- master

jobs:
checks:
runs-on: ubuntu-latest
env:
CGO_ENABLED: "0"
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: true

- name: Check formatting
run: |
test -z "$(gofmt -l .)"

- name: Run go vet
run: go vet ./...

- name: Run tests
run: go test ./...

- name: Run staticcheck
run: |
go install honnef.co/go/tools/cmd/staticcheck@latest
staticcheck ./...
25 changes: 0 additions & 25 deletions .travis.yml

This file was deleted.

7 changes: 1 addition & 6 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,6 @@ import (
"sync"
)

type TcpClient struct {
conn *net.TCPConn
server *net.TCPAddr
}

func handleProxyRequest(localClient *net.TCPConn, serverAddr *net.TCPAddr, auth socks5Auth, recvHTTPProto string) error {

// 远程连接IO
Expand Down Expand Up @@ -105,7 +100,7 @@ func handleProxyRequest(localClient *net.TCPConn, serverAddr *net.TCPAddr, auth
binary.Write(dstPortBuff, binary.BigEndian, dstPortInt)
dstPortBytes := dstPortBuff.Bytes() // int为8字节
resp = append(resp, dstPortBytes[len(dstPortBytes)-2:]...)
n, err = auth.EncodeWrite(dstServer, resp)
_, err = auth.EncodeWrite(dstServer, resp)
if err != nil {
return err
}
Expand Down
4 changes: 2 additions & 2 deletions socks5.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func (s *ProtocolVersion) HandleHandshake(b []byte) ([]byte, error) {
}
s.VER = b[0] //ReadByte reads and returns a single byte,第一个参数为socks的版本号
if s.VER != 0x05 {
return nil, errors.New("协议错误, version版本不为5!")
return nil, errors.New("协议错误, version版本不为5")
}
s.NMETHODS = b[1] //nmethods是记录methods的长度的。nmethods的长度是1个字节
if n != int(2+s.NMETHODS) {
Expand Down Expand Up @@ -196,7 +196,7 @@ func (s *Socks5Resolution) LSTRequest(b []byte) ([]byte, error) {

s.CMD = b[1]
if s.CMD != 1 {
return nil, errors.New("客户端请求类型不为代理连接, 其他功能暂时不支持.")
return nil, errors.New("客户端请求类型不为代理连接, 其他功能暂时不支持")
}
s.RSV = b[2] //RSV保留字端,值长度为1个字节

Expand Down
Loading