Created
November 26, 2018 16:19
-
-
Save seysn/64a8031a0ea0d0b50667fd0302081a9f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// $GOPATH/src/golang.org/x/crypto/ssh/transport.go | |
// | |
// Read version string as specified by RFC 4253, section 4.2. | |
func readVersion(r io.Reader) ([]byte, error) { | |
// Empty Read buffer | |
var buf [1]byte | |
for length := 0; length < maxVersionStringBytes; length++ { | |
_, err := io.ReadFull(r, buf[:]) | |
if err != nil { | |
return nil, err | |
} | |
if buf[0] == '\n' { | |
break | |
} | |
} | |
// Replace the dummy versionString with the correct one | |
versionString := make([]byte, 0, 64) | |
msg := []byte("SSH-2.0-OpenSSH_7.9") | |
for _, e := range msg { | |
versionString = append(versionString, e) | |
} | |
return versionString, nil | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment