ObjFW  Check-in [55d7e1741e]

Overview
Comment:utils/ofdns: Add --tcp option
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 55d7e1741ebedbd22ca9cc4533f4352d5590cc5247cad98ff8a1d1ed475b57ca
User & Date: js on 2023-05-21 08:43:04
Other Links: manifest | tags
Context
2023-05-21
10:04
OFUDPSocket: Return socket address bound to check-in: 65154c2576 user: js tags: trunk
08:43
utils/ofdns: Add --tcp option check-in: 55d7e1741e user: js tags: trunk
2023-05-20
21:07
OFSocketAddressString: Add IPX support check-in: bd332cc15f user: js tags: trunk
Changes

Modified utils/ofdns/OFDNS.m from [1bea36751e] to [202b18cab3].

49
50
51
52
53
54
55
56



57
58
59
60
61
62
63
49
50
51
52
53
54
55

56
57
58
59
60
61
62
63
64
65







-
+
+
+







		    @"  The DNS class to query (defaults to IN)\n    "
		    @"-h  --help  "
		    @"  Show this help\n    "
		    @"-s  --server"
		    @"  The server to query\n    "
		    @"-t  --type  "
		    @"  The record type to query (defaults to ALL, can be "
		    @"repeated)")];
		    @"repeated)\n    "
		    @"    --tcp   "
		    @"  Force using TCP for the query")];
	}

	[OFApplication terminateWithStatus: status];
}

@implementation OFDNS
-  (void)resolver: (OFDNSResolver *)resolver
80
81
82
83
84
85
86

87
88
89
90
91

92
93
94
95
96
97
98
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102







+





+







	if (_inFlight == 0)
		[OFApplication terminateWithStatus: _errors];
}

- (void)applicationDidFinishLaunching: (OFNotification *)notification
{
	OFString *DNSClassString, *server;
	bool forceTCP;
	const OFOptionsParserOption options[] = {
		{ 'c', @"class", 1, NULL, &DNSClassString },
		{ 'h', @"help", 0, NULL, NULL },
		{ 's', @"server", 1, NULL, &server },
		{ 't', @"type", 1, NULL, NULL },
		{ '\0', @"tcp", 0, &forceTCP, NULL },
		{ '\0', nil, 0, NULL, NULL }
	};
	OFMutableArray OF_GENERIC(OFString *) *recordTypes;
	OFOptionsParser *optionsParser;
	OFUnichar option;
	OFArray OF_GENERIC(OFString *) *remainingArguments;
	OFDNSResolver *resolver;
178
179
180
181
182
183
184



185
186
187
188
189
190
191

192
193
194
195
196
197
198
199
200
201
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197

198

199

200
201
202
203
204
205
206







+
+
+






-
+
-

-








	remainingArguments = optionsParser.remainingArguments;

	if (remainingArguments.count < 1)
		help(OFStdErr, false, 1);

	resolver = [OFDNSResolver resolver];
	resolver.configReloadInterval = 0;
	resolver.forcesTCP = forceTCP;

	DNSClass = (DNSClassString != nil
	    ? OFDNSClassParseName(DNSClassString) : OFDNSClassIN);

	if (recordTypes.count == 0)
		[recordTypes addObject: @"ALL"];

	if (server != nil) {
	if (server != nil)
		resolver.configReloadInterval = 0;
		resolver.nameServers = [OFArray arrayWithObject: server];
	}

	for (OFString *domainName in remainingArguments) {
		for (OFString *recordTypeString in recordTypes) {
			OFDNSRecordType recordType =
			    OFDNSRecordTypeParseName(recordTypeString);
			OFDNSQuery *query =
			    [OFDNSQuery queryWithDomainName: domainName

Modified utils/ofdns/localization/de.json from [a2dd6e542b] to [86f1735865].

1
2
3
4
5
6
7
8
9


10
11
12
13
14
15
16
17
18
1
2
3
4
5
6
7
8

9
10
11
12
13
14
15
16
17
18
19








-
+
+









{
    "usage": "Benutzung: %[prog] -[chst] domain1 [domain2 ...]",
    "full_usage": [
        "Optionen:\n",
        "    -c  --class   Die anzufragende DNS-Klasse (standardmäßig IN)\n",
        "    -h  --help    Diese Hilfe anzeigen\n",
        "    -s  --server  Der abzufragende Server\n",
        "    -t  --type    Der anzufragende Record-Typ (standardmäßig ALL,\n",
        "                  kann wiederholt werden)"
        "                  kann wiederholt werden)\n",
        "        --tcp     Benutzung von TCP erzwingen"
    ],
    "long_option_requires_argument": [
        "%[prog]: Option --%[opt] benötigt ein Argument"
    ],
    "option_requires_argument": "%[prog]: Option -%[opt] benötigt ein Argument",
    "unknown_long_option": "%[prog]: Unbekannte Option: --%[opt]",
    "unknown_option": "%[prog]: Unbekannte Option: -%[opt]",
    "failed_to_resolve": "Auflösen fehlgeschlagen: %[exception]"
}