]>
Commit | Line | Data |
---|---|---|
1 | ;ELC\1c\0\0\0 | |
2 | ;;; Compiled | |
3 | ;;; in Emacs version 28.2 | |
4 | ;;; with all optimizations. | |
5 | ||
6 | ||
7 | ||
8 | (require 'dns) | |
9 | #@400 Perform SRV lookup of TARGET and return list of connection candidiates. | |
10 | TARGET is a string of the form "_Service._Proto.Name". | |
11 | ||
12 | Returns a list with elements of the form (HOST . PORT), where HOST is | |
13 | a hostname and PORT is a numeric port. The caller is supposed to | |
14 | make connection attempts in the order given, starting from the beginning | |
15 | of the list. The list is empty if no SRV records were found.\1f | |
16 | (defalias 'srv-lookup #[(target) "\306\b!\19\307\310\302 \236A@\"\1a\311\211\e\1c\n?\206%\0\nG\312=\205%\0\300\n@\236A@\313\230?\205\r\ 1\n\311\1d\211\1e\16\203h\0\ e\16@\15\314\r\236A@\211\1e\f\v\236\211\1e\17\203V\0\ e\17\211\1e\18\r\ e\18AB\241\210)\202^\0\ e\f\rCB\vB\13*\ e\16A\211\16\16\2042\0*\315\v\316\"\211\13\311\1e\19\211\1e\16\203\a\ 1\ e\16@\16\19\317\311\1e\1a\1e\e\ e\19A\311\1d\211\1e\16\203\255\0\ e\16@\15\ e\e\320\r\236A@\\\211\16\e\rB\ e\1aB\16\1a\ e\16A\211\16\16\204\216\0*\ e\1a\237\16\1a\ e\1a\203\375\0\321\ e\eT!\1e\1c\3222\352\0\ e\1a\311\1d\211\1e\16\205\350\0\ e\16@\211\15@\ e\1cY\203\336\0\323\322\r\"\210\ e\16A\211\16\16\204\315\0\311*0\211\1e\1dA\fB\14\324\ e\1d\ e\1a\"\16\1a*\202\263\0*\ e\16A\211\16\16\204x\0*\307\325\f\237\",\207" [target result answers answers-by-priority weighted-result a srv--dns-query mapcar #[(a) "\301\b\236A@\207" [a data] 2] nil 1 "." priority sort #[(a b) "\b@ @W\207" [a b] 2] 0 weight random --cl-block-nil-- throw delq #[(a) "\301\b\236A@\302\b\236A@B\207" [a target port] 3] --dolist-tail-- entry #1=#:v p weight-order weight-acc r next-entry] 5 (#$ . 100)]) | |
17 | #@105 Perform DNS query for TARGET. | |
18 | On Windows, call `srv--nslookup'; on all other systems, call `dns-query'.\1f | |
19 | (defalias 'srv--dns-query #[(target) "\301\302\303\"\203\r\0\304\b\305\306#\207\307\b!\207" [target featurep make-network-process (:type datagram) dns-query SRV t srv--nslookup] 4 (#$ . 1416)]) | |
20 | #@62 Call the `nslookup' program to make an SRV query for TARGET.\1f | |
21 | (defalias 'srv--nslookup #[(target) "\303\304\305\"\18r\bq\210\306\216\307\310\311\305\311\312 &\ 6\210eb\210\311\1a\313\314\311\305#\203F\0\315\316\317\320\321!!D\322\317\320\323!!D\324\317\320\325!!D\301\320\326!DFDC\nB\12\202\1a\0\327\n,DC\207" [#1=#:temp-buffer target results generate-new-buffer " *temp*" t #[nil "\301\b!\205 \0\302\b!\207" [#1# buffer-name kill-buffer] 2] call-process "nslookup" nil "-type=srv" search-forward-regexp "[ ]*priority += \\(.*\\)\r?\n[ ]*weight += \\(.*\\)\r?\n[ ]*port += \\(.*\\)\r?\n[ ]*svr hostname += \\(.*\\)\r?\n" data priority string-to-number match-string 1 weight 2 port 3 4 answers] 7 (#$ . 1716)]) | |
22 | (provide 'srv) |