This commit is contained in:
esrrhs 2023-03-18 13:32:35 +08:00
parent f8d9ed6b5e
commit 520cdd7063
10 changed files with 16 additions and 15 deletions

View File

@ -1,4 +1,4 @@
package main package pingtunnel
import ( import (
"github.com/esrrhs/gohome/common" "github.com/esrrhs/gohome/common"

View File

@ -5,6 +5,7 @@ import (
"fmt" "fmt"
"github.com/esrrhs/gohome/common" "github.com/esrrhs/gohome/common"
"github.com/esrrhs/gohome/loggo" "github.com/esrrhs/gohome/loggo"
"github.com/esrrhs/pingtunnel"
"net" "net"
"net/http" "net/http"
_ "net/http/pprof" _ "net/http/pprof"
@ -166,8 +167,8 @@ func main() {
*tcpmode = 1 *tcpmode = 1
} }
} }
if *tcpmode_maxwin*10 > FRAME_MAX_ID { if *tcpmode_maxwin*10 > pingtunnel.FRAME_MAX_ID {
fmt.Println("set tcp win to big, max = " + strconv.Itoa(FRAME_MAX_ID/10)) fmt.Println("set tcp win to big, max = " + strconv.Itoa(pingtunnel.FRAME_MAX_ID/10))
return return
} }
@ -186,7 +187,7 @@ func main() {
loggo.Info("key %d", *key) loggo.Info("key %d", *key)
if *t == "server" { 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 { if err != nil {
loggo.Error("ERROR: %s", err.Error()) loggo.Error("ERROR: %s", err.Error())
return return
@ -213,7 +214,7 @@ func main() {
} }
if len(*s5filter) > 0 { if len(*s5filter) > 0 {
err := LoadGeoDB(*s5ftfile) err := pingtunnel.LoadGeoDB(*s5ftfile)
if err != nil { if err != nil {
loggo.Error("Load Sock5 ip file ERROR: %s", err.Error()) loggo.Error("Load Sock5 ip file ERROR: %s", err.Error())
return return
@ -229,7 +230,7 @@ func main() {
return false return false
} }
ret, err := GetCountryIsoCode(taddr.IP.String()) ret, err := pingtunnel.GetCountryIsoCode(taddr.IP.String())
if err != nil { if err != nil {
return false return false
} }
@ -239,7 +240,7 @@ func main() {
return ret != *s5filter 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, *tcpmode_buffersize, *tcpmode_maxwin, *tcpmode_resend_timems, *tcpmode_compress,
*tcpmode_stat, *open_sock5, *maxconn, &filter) *tcpmode_stat, *open_sock5, *maxconn, &filter)
if err != nil { if err != nil {

View File

@ -1,4 +1,4 @@
package main package pingtunnel
import ( import (
"errors" "errors"

View File

@ -1,4 +1,4 @@
package main package pingtunnel
import ( import (
"fmt" "fmt"

2
go.mod
View File

@ -1,4 +1,4 @@
module github.com/esrrhs/pingtunnul module github.com/esrrhs/pingtunnel
go 1.18 go 1.18

View File

@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT. // Code generated by protoc-gen-go. DO NOT EDIT.
// source: msg.proto // source: msg.proto
package main package pingtunnel
import ( import (
fmt "fmt" fmt "fmt"

View File

@ -1,5 +1,5 @@
syntax = "proto3"; syntax = "proto3";
option go_package = "main"; option go_package = "pingtunnel";
message MyMsg { message MyMsg {
enum TYPE { enum TYPE {

View File

@ -1,4 +1,4 @@
package main package pingtunnel
import ( import (
"encoding/binary" "encoding/binary"

View File

@ -1,4 +1,4 @@
package main package pingtunnel
import ( import (
"fmt" "fmt"

View File

@ -1,4 +1,4 @@
package main package pingtunnel
import ( import (
"github.com/esrrhs/gohome/common" "github.com/esrrhs/gohome/common"