aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pkg/types/encoding.go12
-rw-r--r--pkg/types/encoding_test.go34
2 files changed, 0 insertions, 46 deletions
diff --git a/pkg/types/encoding.go b/pkg/types/encoding.go
index 54a1ac6..9fd2caa 100644
--- a/pkg/types/encoding.go
+++ b/pkg/types/encoding.go
@@ -2,7 +2,6 @@ package types
import (
"encoding/binary"
- "fmt"
)
// RFC4251, section 5
@@ -18,14 +17,3 @@ func putSSHString(b []byte, str string) int {
return i
}
-
-func getSSHString(b []byte) (*string, error) {
- if len(b) < 4 {
- return nil, fmt.Errorf("types: invalid SSH string")
- }
-
- l := binary.BigEndian.Uint32(b[:4])
- str := string(b[4 : 4+l])
- return &str, nil
-
-}
diff --git a/pkg/types/encoding_test.go b/pkg/types/encoding_test.go
index e079a8c..a050002 100644
--- a/pkg/types/encoding_test.go
+++ b/pkg/types/encoding_test.go
@@ -27,37 +27,3 @@ func TestPutSSHString(t *testing.T) {
}
}
}
-
-func TestGetSSHString(t *testing.T) {
- for _, tbl := range []struct {
- desc string
- in []byte
- want string
- wantErr bool
- }{
- {
- desc: "valid",
- in: []byte{0, 0, 0, 5, 65, 108, 108, 97, 110},
- want: "Allan",
- },
- {
- desc: "invalid: short",
- in: []byte{0, 0, 0},
- wantErr: true,
- },
- } {
- str, err := getSSHString(tbl.in)
-
- if got, want := err != nil, tbl.wantErr; got != want {
- t.Errorf("%q: error: got %v but wanted %v: %v", tbl.desc, got, want, err)
- }
-
- if err != nil {
- continue
- }
-
- if got, want := str, tbl.want; *got != want {
- t.Errorf(`%q: got "%v" but wanted "%v"`, tbl.desc, *got, want)
- }
- }
-}