Skip to content

Commit

Permalink
Lint
Browse files Browse the repository at this point in the history
  • Loading branch information
jaksi committed Aug 3, 2024
1 parent 20adb3e commit 026a874
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 9 deletions.
3 changes: 2 additions & 1 deletion conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"errors"
"fmt"
"net"
"strconv"

"golang.org/x/crypto/ssh"
)
Expand Down Expand Up @@ -196,7 +197,7 @@ func (channel *Channel) String() string {

func handleChannel(sshChannel ssh.Channel, sshRequests <-chan *ssh.Request, conn *Conn, name string) *Channel {
requests := make(chan *ChannelRequest)
channel := &Channel{sshChannel, requests, fmt.Sprint(conn.nextChannelID), name, conn}
channel := &Channel{sshChannel, requests, strconv.FormatInt(int64(conn.nextChannelID), 10), name, conn}
go func() {
for request := range sshRequests {
requests <- &ChannelRequest{request, channel}
Expand Down
1 change: 1 addition & 0 deletions conn_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"sync"
"testing"

//nolint:depguard
"github.com/jaksi/sshutils"
"golang.org/x/crypto/ssh"
)
Expand Down
1 change: 1 addition & 0 deletions host_keys_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"strings"
"testing"

//nolint:depguard
"github.com/jaksi/sshutils"
"golang.org/x/crypto/ssh"
)
Expand Down
15 changes: 8 additions & 7 deletions serialization.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"io"
"net"
"sort"
"strconv"
"strings"

"golang.org/x/crypto/ssh"
Expand Down Expand Up @@ -83,7 +84,7 @@ type X11ChannelPayload struct {

func (payload *X11ChannelPayload) String() string {
return fmt.Sprintf("x11: %v",
net.JoinHostPort(payload.OriginatorAddress, fmt.Sprintf("%v", payload.OriginatorPort)))
net.JoinHostPort(payload.OriginatorAddress, strconv.FormatInt(int64(payload.OriginatorPort), 10)))
}

func (payload *X11ChannelPayload) Unmarshal(data []byte) error {
Expand Down Expand Up @@ -111,8 +112,8 @@ type ForwardedTcpipChannelPayload struct {

func (payload *ForwardedTcpipChannelPayload) String() string {
return fmt.Sprintf("forwarded-tcpip: %v -> %v",
net.JoinHostPort(payload.OriginatorAddress, fmt.Sprintf("%v", payload.OriginatorPort)),
net.JoinHostPort(payload.Address, fmt.Sprintf("%v", payload.Port)))
net.JoinHostPort(payload.OriginatorAddress, strconv.FormatInt(int64(payload.OriginatorPort), 10)),
net.JoinHostPort(payload.Address, strconv.FormatInt(int64(payload.Port), 10)))
}

func (payload *ForwardedTcpipChannelPayload) Unmarshal(data []byte) error {
Expand Down Expand Up @@ -140,8 +141,8 @@ type DirectTcpipChannelPayload struct {

func (payload *DirectTcpipChannelPayload) String() string {
return fmt.Sprintf("direct-tcpip: %v -> %v",
net.JoinHostPort(payload.OriginatorAddress, fmt.Sprintf("%v", payload.OriginatorPort)),
net.JoinHostPort(payload.Address, fmt.Sprintf("%v", payload.Port)))
net.JoinHostPort(payload.OriginatorAddress, strconv.FormatInt(int64(payload.OriginatorPort), 10)),
net.JoinHostPort(payload.Address, strconv.FormatInt(int64(payload.Port), 10)))
}

func (payload *DirectTcpipChannelPayload) Unmarshal(data []byte) error {
Expand Down Expand Up @@ -291,7 +292,7 @@ type tcpipRequestPayload struct {
type TcpipForwardRequestPayload tcpipRequestPayload

func (payload *TcpipForwardRequestPayload) String() string {
return fmt.Sprintf("tcpip-forward: %v", net.JoinHostPort(payload.Address, fmt.Sprint(payload.Port)))
return fmt.Sprintf("tcpip-forward: %v", net.JoinHostPort(payload.Address, strconv.FormatInt(int64(payload.Port), 10)))
}

func (payload *TcpipForwardRequestPayload) Unmarshal(data []byte) error {
Expand All @@ -317,7 +318,7 @@ func (payload *TcpipForwardRequestPayload) Response(port uint32) []byte {
type CancelTcpipForwardRequestPayload tcpipRequestPayload

func (payload *CancelTcpipForwardRequestPayload) String() string {
return fmt.Sprintf("cancel-tcpip-forward: %v", net.JoinHostPort(payload.Address, fmt.Sprint(payload.Port)))
return fmt.Sprintf("cancel-tcpip-forward: %v", net.JoinHostPort(payload.Address, strconv.FormatInt(int64(payload.Port), 10)))
}

func (payload *CancelTcpipForwardRequestPayload) Unmarshal(data []byte) error {
Expand Down
3 changes: 2 additions & 1 deletion serialization_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"strings"
"testing"

//nolint:depguard
"github.com/jaksi/sshutils"
"golang.org/x/crypto/ssh"
)
Expand All @@ -22,7 +23,7 @@ func (newChannel *fakeNewChannel) Accept() (ssh.Channel, <-chan *ssh.Request, er
panic("not implemented")
}

func (newChannel *fakeNewChannel) Reject(reason ssh.RejectionReason, message string) error {
func (newChannel *fakeNewChannel) Reject(_ ssh.RejectionReason, _ string) error {
panic("not implemented")
}

Expand Down

0 comments on commit 026a874

Please sign in to comment.