Skip to content

Commit

Permalink
fix: sshd port change
Browse files Browse the repository at this point in the history
  • Loading branch information
shoriwe committed Jun 12, 2023
1 parent df9990d commit 1bf7078
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
with:
go-version: "1.20"
- name: Set up docker environment
run: docker compose up -d && sleep 2m
run: docker compose up -d
- name: Test
run: go test -p 1 -count 1 -coverpkg ./... -coverprofile coverage.txt -covermode count ./...
- uses: codecov/codecov-action@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ jobs:
- name: Set up docker environment
run: docker compose up -d
- name: Test
run: go test -p 1 -count 1 -v ./... && sleep 2m
run: go test -p 1 -count 1 -v ./...
- name: Clean docker environment
run: docker compose --rmi all -v --remove-orphans
4 changes: 2 additions & 2 deletions circuit/circuit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func TestCircuit_Dial(t *testing.T) {
},
&SSH{
Network: "tcp",
Address: "localhost:2222",
Address: sshd.DefaultAddr,
Config: *sshd.DefaultClientConfig(),
},
}
Expand All @@ -45,7 +45,7 @@ func TestCircuit_Dial(t *testing.T) {
circuit := &Circuit{
Chain: []Knot{&SSH{
Network: "tcp",
Address: "localhost:2222",
Address: sshd.DefaultAddr,
}},
}
_, err := circuit.Dial("tcp", "echo:80")
Expand Down
2 changes: 1 addition & 1 deletion circuit/ssh_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ func TestSSH_Next(t *testing.T) {
t.Run("Basic", func(tt *testing.T) {
s := &SSH{
Network: "tcp",
Address: "localhost:2222",
Address: sshd.DefaultAddr,
Config: *sshd.DefaultClientConfig(),
}
closeFunc, dial, err := s.Next(net.Dial)
Expand Down
10 changes: 5 additions & 5 deletions compose/network_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ func TestNetwork_setupSSHListener(t *testing.T) {
},
}
*l.Network = "tcp"
*l.Address = "localhost:2222"
*l.Address = sshd.DefaultAddr
*l.Data.Network = "tcp"
*l.Data.Address = "localhost:0"
*l.Auth.Username = sshd.SSHDefaultUser
Expand Down Expand Up @@ -252,7 +252,7 @@ func TestNetwork_setupSSHListener(t *testing.T) {
Auth: &Auth{},
}
*l.Network = "tcp"
*l.Address = "localhost:2222"
*l.Address = sshd.DefaultAddr
*l.Data.Network = "tcp"
*l.Data.Address = "localhost:0"
_, err := l.setupSSHListener()
Expand Down Expand Up @@ -334,7 +334,7 @@ func TestNetwork_Listen(t *testing.T) {
},
}
*l.Network = "tcp"
*l.Address = "localhost:2222"
*l.Address = sshd.DefaultAddr
*l.Data.Network = "tcp"
*l.Data.Address = "localhost:0"
*l.Auth.Username = sshd.SSHDefaultUser
Expand Down Expand Up @@ -411,7 +411,7 @@ func TestNetwork_setupSSHDialFunc(t *testing.T) {
},
}
*l.Network = "tcp"
*l.Address = "localhost:2222"
*l.Address = sshd.DefaultAddr
*l.Data.Network = "tcp"
*l.Data.Address = "localhost:0"
*l.Auth.Username = sshd.SSHDefaultUser
Expand Down Expand Up @@ -479,7 +479,7 @@ func TestNetwork_DialFunc(t *testing.T) {
},
}
*l.Network = "tcp"
*l.Address = "localhost:2222"
*l.Address = sshd.DefaultAddr
*l.Data.Network = "tcp"
*l.Data.Address = "localhost:0"
*l.Auth.Username = sshd.SSHDefaultUser
Expand Down
4 changes: 2 additions & 2 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ services:
networks:
- fullproxy
ports:
- "127.0.0.1:2222:22"
#- "[::1]:2222:22"
- "127.0.0.1:22222:22"
#- "[::1]:22222:22"
volumes:
- ./sshd/entrypoint.sh:/etc/entrypoint.d/entrypoint.sh:ro
environment:
Expand Down
3 changes: 2 additions & 1 deletion sshd/default.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
const (
SSHDefaultUser = "low"
SSHDefaultPassword = "password"
DefaultAddr = "localhost:22222"
)

func DefaultClientConfig() *ssh.ClientConfig {
Expand All @@ -24,7 +25,7 @@ func DefaultClientConfig() *ssh.ClientConfig {
}

func DefaultClient(t *testing.T) *ssh.Client {
client, dErr := ssh.Dial("tcp", "localhost:2222", DefaultClientConfig())
client, dErr := ssh.Dial("tcp", DefaultAddr, DefaultClientConfig())
assert.Nil(t, dErr)
return client
}
Expand Down

0 comments on commit 1bf7078

Please sign in to comment.