1
1
Fork 0
mirror of https://github.com/schollz/croc.git synced 2025-10-11 05:11:06 +02:00

go.mod v9 -> v10

This commit is contained in:
Zack 2024-05-23 06:25:53 -07:00
parent 7acd2def69
commit 6181903c83
13 changed files with 49 additions and 34 deletions

View file

@ -10,12 +10,12 @@ install: true
script: script:
- env GO111MODULE=on go build -v - env GO111MODULE=on go build -v
- env GO111MODULE=on go test -v -cover github.com/schollz/croc/v9/src/compress - env GO111MODULE=on go test -v -cover github.com/schollz/croc/v10/src/compress
- env GO111MODULE=on go test -v -cover github.com/schollz/croc/v9/src/croc - env GO111MODULE=on go test -v -cover github.com/schollz/croc/v10/src/croc
- env GO111MODULE=on go test -v -cover github.com/schollz/croc/v9/src/crypt - env GO111MODULE=on go test -v -cover github.com/schollz/croc/v10/src/crypt
- env GO111MODULE=on go test -v -cover github.com/schollz/croc/v9/src/tcp - env GO111MODULE=on go test -v -cover github.com/schollz/croc/v10/src/tcp
- env GO111MODULE=on go test -v -cover github.com/schollz/croc/v9/src/utils - env GO111MODULE=on go test -v -cover github.com/schollz/croc/v10/src/utils
- env GO111MODULE=on go test -v -cover github.com/schollz/croc/v9/src/comm - env GO111MODULE=on go test -v -cover github.com/schollz/croc/v10/src/comm
branches: branches:
except: except:

View file

@ -108,7 +108,7 @@ pkg install croc
Or, you can [install Go](https://golang.org/dl/) and build from source (requires Go 1.17+): Or, you can [install Go](https://golang.org/dl/) and build from source (requires Go 1.17+):
``` ```
go install github.com/schollz/croc/v9@latest go install github.com/schollz/croc/v10@latest
``` ```
On Android there is a 3rd party F-Droid app [available to download](https://f-droid.org/en/packages/com.github.howeyc.crocgui/). On Android there is a 3rd party F-Droid app [available to download](https://f-droid.org/en/packages/com.github.howeyc.crocgui/).

2
go.mod
View file

@ -1,4 +1,4 @@
module github.com/schollz/croc/v9 module github.com/schollz/croc/v10
go 1.20 go 1.20

View file

@ -7,7 +7,7 @@ package main
import ( import (
"log" "log"
"github.com/schollz/croc/v9/src/cli" "github.com/schollz/croc/v10/src/cli"
) )
func main() { func main() {

View file

@ -15,11 +15,11 @@ import (
"github.com/chzyer/readline" "github.com/chzyer/readline"
"github.com/schollz/cli/v2" "github.com/schollz/cli/v2"
"github.com/schollz/croc/v9/src/comm" "github.com/schollz/croc/v10/src/comm"
"github.com/schollz/croc/v9/src/croc" "github.com/schollz/croc/v10/src/croc"
"github.com/schollz/croc/v9/src/models" "github.com/schollz/croc/v10/src/models"
"github.com/schollz/croc/v9/src/tcp" "github.com/schollz/croc/v10/src/tcp"
"github.com/schollz/croc/v9/src/utils" "github.com/schollz/croc/v10/src/utils"
log "github.com/schollz/logger" log "github.com/schollz/logger"
"github.com/schollz/mnemonicode" "github.com/schollz/mnemonicode"
"github.com/schollz/pake/v3" "github.com/schollz/pake/v3"

View file

@ -11,7 +11,7 @@ import (
"time" "time"
"github.com/magisterquis/connectproxy" "github.com/magisterquis/connectproxy"
"github.com/schollz/croc/v9/src/utils" "github.com/schollz/croc/v10/src/utils"
log "github.com/schollz/logger" log "github.com/schollz/logger"
"golang.org/x/net/proxy" "golang.org/x/net/proxy"
) )

View file

@ -28,13 +28,13 @@ import (
"github.com/schollz/peerdiscovery" "github.com/schollz/peerdiscovery"
"github.com/schollz/progressbar/v3" "github.com/schollz/progressbar/v3"
"github.com/schollz/croc/v9/src/comm" "github.com/schollz/croc/v10/src/comm"
"github.com/schollz/croc/v9/src/compress" "github.com/schollz/croc/v10/src/compress"
"github.com/schollz/croc/v9/src/crypt" "github.com/schollz/croc/v10/src/crypt"
"github.com/schollz/croc/v9/src/message" "github.com/schollz/croc/v10/src/message"
"github.com/schollz/croc/v9/src/models" "github.com/schollz/croc/v10/src/models"
"github.com/schollz/croc/v9/src/tcp" "github.com/schollz/croc/v10/src/tcp"
"github.com/schollz/croc/v9/src/utils" "github.com/schollz/croc/v10/src/utils"
) )
var ( var (

View file

@ -10,7 +10,7 @@ import (
"testing" "testing"
"time" "time"
"github.com/schollz/croc/v9/src/tcp" "github.com/schollz/croc/v10/src/tcp"
log "github.com/schollz/logger" log "github.com/schollz/logger"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
) )

View file

@ -3,9 +3,9 @@ package message
import ( import (
"encoding/json" "encoding/json"
"github.com/schollz/croc/v9/src/comm" "github.com/schollz/croc/v10/src/comm"
"github.com/schollz/croc/v9/src/compress" "github.com/schollz/croc/v10/src/compress"
"github.com/schollz/croc/v9/src/crypt" "github.com/schollz/croc/v10/src/crypt"
log "github.com/schollz/logger" log "github.com/schollz/logger"
) )

View file

@ -7,8 +7,8 @@ import (
"testing" "testing"
"time" "time"
"github.com/schollz/croc/v9/src/comm" "github.com/schollz/croc/v10/src/comm"
"github.com/schollz/croc/v9/src/crypt" "github.com/schollz/croc/v10/src/crypt"
log "github.com/schollz/logger" log "github.com/schollz/logger"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
) )
@ -84,7 +84,7 @@ func TestSend(t *testing.T) {
} }
}() }()
time.Sleep(300 * time.Millisecond) time.Sleep(800 * time.Millisecond)
a, err := comm.NewConnection("127.0.0.1:"+port, 10*time.Minute) a, err := comm.NewConnection("127.0.0.1:"+port, 10*time.Minute)
assert.Nil(t, err) assert.Nil(t, err)
m := Message{Type: TypeMessage, Message: "hello, world"} m := Message{Type: TypeMessage, Message: "hello, world"}

View file

@ -7,7 +7,7 @@ import (
"os" "os"
"path" "path"
"github.com/schollz/croc/v9/src/utils" "github.com/schollz/croc/v10/src/utils"
) )
// TCP_BUFFER_SIZE is the maximum packet size // TCP_BUFFER_SIZE is the maximum packet size

View file

@ -11,9 +11,9 @@ import (
log "github.com/schollz/logger" log "github.com/schollz/logger"
"github.com/schollz/pake/v3" "github.com/schollz/pake/v3"
"github.com/schollz/croc/v9/src/comm" "github.com/schollz/croc/v10/src/comm"
"github.com/schollz/croc/v9/src/crypt" "github.com/schollz/croc/v10/src/crypt"
"github.com/schollz/croc/v9/src/models" "github.com/schollz/croc/v10/src/models"
) )
type server struct { type server struct {

View file

@ -208,9 +208,24 @@ func TestGetRandomName(t *testing.T) {
assert.NotEmpty(t, name) assert.NotEmpty(t, name)
} }
func intSliceSame(a, b []int) bool {
if len(a) != len(b) {
return false
}
for i, v := range a {
if v != b[i] {
return false
}
}
return true
}
func TestFindOpenPorts(t *testing.T) { func TestFindOpenPorts(t *testing.T) {
openPorts := FindOpenPorts("127.0.0.1", 9009, 4) openPorts := FindOpenPorts("127.0.0.1", 9009, 4)
assert.Equal(t, []int{9009, 9010, 9011, 9012}, openPorts) if !intSliceSame(openPorts, []int{9009, 9010, 9011, 9012}) && !intSliceSame(openPorts, []int{9014, 9015, 9016, 9017}) {
t.Errorf("openPorts: %v", openPorts)
}
} }
func TestIsLocalIP(t *testing.T) { func TestIsLocalIP(t *testing.T) {