diff --git a/client.go b/client.go index 434e49a..9507ee6 100644 --- a/client.go +++ b/client.go @@ -1,4 +1,4 @@ -package main +package pingtunnel import ( "github.com/esrrhs/gohome/common" diff --git a/main.go b/cmd/main.go similarity index 94% rename from main.go rename to cmd/main.go index 96f623a..cb83373 100644 --- a/main.go +++ b/cmd/main.go @@ -5,6 +5,7 @@ import ( "fmt" "github.com/esrrhs/gohome/common" "github.com/esrrhs/gohome/loggo" + "github.com/esrrhs/pingtunnel" "net" "net/http" _ "net/http/pprof" @@ -166,8 +167,8 @@ func main() { *tcpmode = 1 } } - if *tcpmode_maxwin*10 > FRAME_MAX_ID { - fmt.Println("set tcp win to big, max = " + strconv.Itoa(FRAME_MAX_ID/10)) + if *tcpmode_maxwin*10 > pingtunnel.FRAME_MAX_ID { + fmt.Println("set tcp win to big, max = " + strconv.Itoa(pingtunnel.FRAME_MAX_ID/10)) return } @@ -186,7 +187,7 @@ func main() { loggo.Info("key %d", *key) if *t == "server" { - s, err := NewServer(*key, *maxconn, *max_process_thread, *max_process_buffer, *conntt) + s, err := pingtunnel.NewServer(*key, *maxconn, *max_process_thread, *max_process_buffer, *conntt) if err != nil { loggo.Error("ERROR: %s", err.Error()) return @@ -213,7 +214,7 @@ func main() { } if len(*s5filter) > 0 { - err := LoadGeoDB(*s5ftfile) + err := pingtunnel.LoadGeoDB(*s5ftfile) if err != nil { loggo.Error("Load Sock5 ip file ERROR: %s", err.Error()) return @@ -229,7 +230,7 @@ func main() { return false } - ret, err := GetCountryIsoCode(taddr.IP.String()) + ret, err := pingtunnel.GetCountryIsoCode(taddr.IP.String()) if err != nil { return false } @@ -239,7 +240,7 @@ func main() { return ret != *s5filter } - c, err := NewClient(*listen, *server, *target, *timeout, *key, + c, err := pingtunnel.NewClient(*listen, *server, *target, *timeout, *key, *tcpmode, *tcpmode_buffersize, *tcpmode_maxwin, *tcpmode_resend_timems, *tcpmode_compress, *tcpmode_stat, *open_sock5, *maxconn, &filter) if err != nil { diff --git a/country.go b/country.go index 752b373..8a43c87 100644 --- a/country.go +++ b/country.go @@ -1,4 +1,4 @@ -package main +package pingtunnel import ( "errors" diff --git a/country_test.go b/country_test.go index f70496e..e376d4d 100644 --- a/country_test.go +++ b/country_test.go @@ -1,4 +1,4 @@ -package main +package pingtunnel import ( "fmt" diff --git a/go.mod b/go.mod index 2830d07..c19bc8b 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/esrrhs/pingtunnul +module github.com/esrrhs/pingtunnel go 1.18 diff --git a/msg.pb.go b/msg.pb.go index 181635f..1be852e 100644 --- a/msg.pb.go +++ b/msg.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // source: msg.proto -package main +package pingtunnel import ( fmt "fmt" diff --git a/msg.proto b/msg.proto index 52f4530..805dbef 100644 --- a/msg.proto +++ b/msg.proto @@ -1,5 +1,5 @@ syntax = "proto3"; -option go_package = "main"; +option go_package = "pingtunnel"; message MyMsg { enum TYPE { diff --git a/pingtunnel.go b/pingtunnel.go index ab6a1d2..73d046d 100644 --- a/pingtunnel.go +++ b/pingtunnel.go @@ -1,4 +1,4 @@ -package main +package pingtunnel import ( "encoding/binary" diff --git a/pingtunnel_test.go b/pingtunnel_test.go index ad2ff3f..31d0da0 100644 --- a/pingtunnel_test.go +++ b/pingtunnel_test.go @@ -1,4 +1,4 @@ -package main +package pingtunnel import ( "fmt" diff --git a/server.go b/server.go index 252c0f5..38e21da 100644 --- a/server.go +++ b/server.go @@ -1,4 +1,4 @@ -package main +package pingtunnel import ( "github.com/esrrhs/gohome/common"