mirror of
https://github.com/qinyuhang/ShadowsocksX-NG-R.git
synced 2026-10-25 01:40:15 +00:00
Merge pull request #139 from KevinWang15/patch-1
underscores should be allowed in domain names
This commit is contained in:
@@ -131,7 +131,7 @@ class ServerProfile: NSObject {
|
||||
}
|
||||
|
||||
func validateDomainName(_ value: String) -> Bool {
|
||||
let validHostnameRegex = "^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\-]*[a-zA-Z0-9])\\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\-]*[A-Za-z0-9])$"
|
||||
let validHostnameRegex = "^(([a-zA-Z0-9_]|[a-zA-Z0-9_][a-zA-Z0-9\\-_]*[a-zA-Z0-9_])\\.)*([A-Za-z0-9_]|[A-Za-z0-9_][A-Za-z0-9\\-_]*[A-Za-z0-9_])$"
|
||||
|
||||
if (value.range(of: validHostnameRegex, options: .regularExpression) != nil) {
|
||||
return true
|
||||
|
||||
Reference in New Issue
Block a user