defaults normalizes zero-values into sane defaults.
()
| 92 | |
| 93 | // defaults normalizes zero-values into sane defaults. |
| 94 | func (c *ProbeConfig) defaults() { |
| 95 | if c.TargetPort == 0 { |
| 96 | c.TargetPort = 443 |
| 97 | } |
| 98 | if c.ConnectTimeout <= 0 { |
| 99 | c.ConnectTimeout = 3 * time.Second |
| 100 | } |
| 101 | if c.HandshakeTimeout <= 0 { |
| 102 | c.HandshakeTimeout = 4 * time.Second |
| 103 | } |
| 104 | if c.Concurrency <= 0 { |
| 105 | c.Concurrency = 16 |
| 106 | } |
| 107 | } |
| 108 | |
| 109 | // ProbeSNI runs a single TLS handshake attempt against cfg.TargetIP using |
| 110 | // sni as the SNI. Returns a classified Result; Err is always non-empty for |