1//2// TORNode.h3// Tor4//5// Created by Benjamin Erhart on 09.12.19.6//78#import <Foundation/Foundation.h>910NS_ASSUME_NONNULL_BEGIN1112NS_SWIFT_NAME(TorNode)13@interface TORNode : NSObject<NSSecureCoding>1415/**16Regular expression to identify and extract a valid IPv4 address.1718Taken from https://nbviewer.jupyter.org/github/rasbt/python_reference/blob/master/tutorials/useful_regex.ipynb19*/20@property (class, nonatomic, readonly) NSRegularExpression *ipv4Regex;2122/**23Regular expression to identify and extract a valid IPv6 address.2425Taken from https://nbviewer.jupyter.org/github/rasbt/python_reference/blob/master/tutorials/useful_regex.ipynb26*/27@property (class, nonatomic, readonly) NSRegularExpression *ipv6Regex;2829/**30 The fingerprint aka. ID of a Tor node.31 */32@property (nonatomic, nullable) NSString *fingerprint;3334/**35 The nickname of a Tor node.36 */37@property (nonatomic, nullable) NSString *nickName;3839/**40 The IPv4 address of a Tor node.41 */42@property (nonatomic, nullable) NSString *ipv4Address;4344/**45 The IPv6 address of a Tor node.46 */47@property (nonatomic, nullable) NSString *ipv6Address;4849/**50 The country code of a Tor node's country.51 */52@property (nonatomic, nullable) NSString *countryCode;5354/**55 The localized country name of a Tor node's country.56 */57@property (nonatomic, readonly, nullable) NSString *localizedCountryName;5859/**60 If this node can act as an exit node or not.61 */62@property BOOL isExit;6364/**65 Create a `TORNode` object from a "LongName" node string which should contain the fingerprint and the nickname.6667 See https://torproject.gitlab.io/torspec/control-spec.html#general-use-tokens6869 @param longName A "LongName" identifying a Tor node.70 */71-(instancetype)initFromString:(NSString *)longName;7273/**74 Creates a list of `TORNode` objects from the response of a `ns/[*]` call which should contain the nickname and IP address(es).7576 See https://torproject.gitlab.io/torspec/control-spec.html#getinfo7778 @param nsString Response from `ns/[*]` call, identifying one or more Tor nodes.79 @return a list of `TORNode`s discovered in the given string. Might be empty.80 */81+(NSArray<TORNode *>* _Nonnull)parseFromNsString:(NSString * _Nullable)nsString exitOnly:(BOOL)exitOnly;828384/**85 Acquires IPv4 and IPv6 addresses from the given string.8687 See https://torproject.gitlab.io/torspec/control-spec.html#getinfo8889 @param response Should be the response of a `ns/id/<fingerprint>` call.90 */91-(void)acquireIpAddressesFromNsResponse:(NSString *)response;9293@end9495NS_ASSUME_NONNULL_END