@@ -8,17 +8,43 @@ import (
88 "github.com/stretchr/testify/require"
99)
1010
11- func BenchmarkParseSSH (b * testing.B ) {
12- packet , close := testPacketBench (b , "ssh" )
11+ func benchSSH (b * testing.B , path string ) {
12+ b .Helper ()
13+ ssh := & SSHMessage {}
14+
15+ packet , close := testPacketBench (b , path )
1316 defer close ()
1417 b .ResetTimer ()
15- ssh := & SSHMessage {}
1618 for i := 0 ; i < b .N ; i ++ {
1719 _ = ssh .Parse (packet )
1820 fmt .Fprint (io .Discard , ssh .String ())
1921 }
2022}
2123
24+ func BenchmarkParseSSHProtoEx (b * testing.B ) {
25+ benchSSH (b , "ssh_proto_ex" )
26+ }
27+
28+ func BenchmarkParseSSHKeyExInitClient (b * testing.B ) {
29+ benchSSH (b , "ssh_client_kex_init" )
30+ }
31+
32+ func BenchmarkParseSSHKeyExInitServer (b * testing.B ) {
33+ benchSSH (b , "ssh_server_kex_init" )
34+ }
35+
36+ func BenchmarkParseSSHKeyExDHClient (b * testing.B ) {
37+ benchSSH (b , "ssh_client_dh_kex" )
38+ }
39+
40+ func BenchmarkParseSSHKeyExDHServer (b * testing.B ) {
41+ benchSSH (b , "ssh_server_dh_kex" )
42+ }
43+
44+ func BenchmarkParseSSHNewKeysClient (b * testing.B ) {
45+ benchSSH (b , "ssh_client_new_keys" )
46+ }
47+
2248func TestParseSSHProtoEx (t * testing.T ) {
2349 expected := & SSHMessage {Protocol : "SSH-2.0-OpenSSH_8.9p1 Ubuntu-3ubuntu0.10" }
2450 ssh := & SSHMessage {}
0 commit comments