     }
 }
 
+@available (OSX 10.13, *)
+public extension Netrc {
+    
+    enum Error: Swift.Error {
+        case fileNotFound(Foundation.URL)
+        case unreadableFile(Foundation.URL)
+        case machineNotFound
+        case invalidDefaultMachinePosition
+    }
+    
+    
+    /// Representation of connection settings
+    /// - important: Default connection settings are stored in machine named `default`
+    struct Machine: Equatable {
+        public let name: String
+        public let login: String
+        public let password: String
+        
+        public var isDefault: Bool {
+            return name == "default"
+        }
+        
+        public init(name: String, login: String, password: String) {
+            self.name = name
+            self.login = login
+            self.password = password
+        }
+        
+        init?(for match: NSTextCheckingResult, string: String, variant: String = "") {
+            guard let name = RegexUtil.Token.machine.capture(in: match, string: string) ?? RegexUtil.Token.default.capture(in: match, string: string),
+                let login = RegexUtil.Token.login.capture(prefix: variant, in: match, string: string),
+                let password = RegexUtil.Token.password.capture(prefix: variant, in: match, string: string) else {
+                    return nil
+            }
+            self = Machine(name: name, login: login, password: password)
+        }
+    }
+}
+
+@available (OSX 10.13, *)
 fileprivate enum RegexUtil {
+    
+    @frozen fileprivate enum Token: String, CaseIterable {
+        
+        case machine, login, password, account, macdef, `default`
+        
+        func capture(prefix: String = "", in match: NSTextCheckingResult, string: String) -> String? {
+            guard let range = Range(match.range(withName: prefix + rawValue), in: string) else { return nil }
+            return String(string[range])
+        }
+    }
 
     static let comments: String = "\\#[\\s\\S]*?.*$"
     

        return "Basic \(authData.base64EncodedString())"
    }
    
    public static func load(from fileURL: Foundation.URL = Foundation.URL(fileURLWithPath: "\(NSHomeDirectory())/.netrc")) -> Result<Netrc, Netrc.Error> {
        guard FileManager.default.fileExists(atPath: fileURL.path) else { return .failure(.fileNotFound(fileURL)) }
        guard FileManager.default.isReadableFile(atPath: fileURL.path),

        return Netrc.from(fileContents)
    }
    
    
    /// Regex matching logic for deriving `Netrc` container from string content
    /// - Parameter content: String text of netrc file
    /// - Returns: `Netrc` container with parsed connection settings, or error
    public static func from(_ content: String) -> Result<Netrc, Netrc.Error> {
        
        let content = trimComments(from: content)
