mirror of
https://github.com/Gu1llaum-3/sshm.git
synced 2026-01-27 03:04:21 +01:00
fix: problems with quotes from Host names and support SSH tokens (issue #32)
This commit is contained in:
@@ -24,6 +24,19 @@ func TestValidateHostname(t *testing.T) {
|
||||
{"hostname ending with dot", "example.com.", false},
|
||||
{"hostname with hyphen", "my-server.com", true},
|
||||
{"hostname starting with number", "1example.com", true},
|
||||
{"multiple hyphens and subdomains", "my-host-name-01.cwd.pub.domain.net", true},
|
||||
{"multiple hyphens", "my-host-name-01", true},
|
||||
{"complex hostname with hyphens", "server-01-prod.data-center.example.com", true},
|
||||
{"hostname with consecutive hyphens", "my--server.com", true},
|
||||
{"single char labels", "a.b.c.d.com", true},
|
||||
// SSH tokens support (issue #32 comment)
|
||||
{"SSH token %h", "%h.server.com", true},
|
||||
{"SSH token %p", "server.com:%p", true},
|
||||
{"SSH token %r", "%r@server.com", true},
|
||||
{"SSH token %u", "%u.example.com", true},
|
||||
{"SSH token %n", "%n.domain.net", true},
|
||||
{"SSH token %C", "host-%C.com", true},
|
||||
{"multiple SSH tokens", "%h.%u.server.com", true},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
|
||||
Reference in New Issue
Block a user