;ELC   
;;; Compiled
;;; in Emacs version 29.4
;;; with all optimizations.



(byte-code "\300\301\302\303\304\305\306\307\310\311&	\210\312\313\314\315\316DD\317\320\321%\207" [custom-declare-group socks nil "SOCKS support." :version "22.2" :prefix "socks-" :group processes custom-declare-variable socks-server funcall function #[0 "\300\301\302\303F\207" ["Default server" "socks" 1080 5] 4 #1=""] "Socks server." :type (list (string :format #1# :value "Default server") (string :tag "Server") (integer :tag "Port") (radio-button-choice :tag "SOCKS Version" :format "%t: %v" (const :tag "SOCKS v4  " :format "%t" :value 4) (const :tag "SOCKS v5" :format "%t" :value 5)))] 10)
(defconst socks-version 5)
(defvar socks-debug nil)
(defconst socks-connect-command 1)
(defconst socks-bind-command 2)
(defconst socks-udp-associate-command 3)
(defconst socks-authentication-null 0)
(defconst socks-authentication-failure 255)
(defconst socks-response-success 0)
(defconst socks-response-general-failure 1)
(defconst socks-response-access-denied 2)
(defconst socks-response-network-unreachable 3)
(defconst socks-response-host-unreachable 4)
(defconst socks-response-connection-refused 5)
(defconst socks-response-ttl-expired 6)
(defconst socks-response-cmd-not-supported 7)
(defconst socks-response-address-not-supported 8)
(defvar socks-errors '("Succeeded" "General SOCKS server failure" "Connection not allowed by ruleset" "Network unreachable" "Host unreachable" "Connection refused" "Time-to-live expired" "Command not supported" "Address type not supported"))
(defconst socks-address-type-v4 1)
(defconst socks-address-type-name 3)
(defconst socks-address-type-v6 4)
(defvar socks-timeout 5)
(defvar socks-authentication-methods nil)
(defvar socks-username (user-login-name))
(defvar socks-password nil)#@25 

(fn ID DESC CALLBACK)
(defalias 'socks-register-authentication-method #[771 "\236\211\203 \211B\241\207BBB\211\207" [socks-authentication-methods] 7 (#$ . 1811)])#@11 

(fn ID)
(defalias 'socks-unregister-authentication-method #[257 "\211\236\211\205 \301\"\211\207" [socks-authentication-methods delq] 5 (#$ . 1991)])
(socks-register-authentication-method 0 "No authentication" 'identity)
(defalias 'socks-build-auth-list #[0 "\301C\302C\303\304\305#\306!\"\210\307\310\242\242#\207" [socks-authentication-methods 0 "" mapc make-closure #[257 "\302AA!\205 \300\303\304\300\242@#\240\210\301\211\242T\240\207" [V0 V1 fboundp format "%s%c"] 6 "\n\n(fn X)"] reverse format "%c%s"] 7])
(defconst socks-state-waiting-for-auth 0)
(defconst socks-state-submethod-negotiation 1)
(defconst socks-state-authenticated 2)
(defconst socks-state-waiting 3)
(defconst socks-state-connected 4)#@23 

(fn PROC CUR-STATE)
(defalias 'socks-wait-for-state-change #[514 "\301\302\"U\205 \303!\304>\205 \305\"\210\202  \207" [socks-timeout process-get socks-state process-status (run open) accept-process-output] 5 (#$ . 2721)])#@20 

(fn PROC STRING)
(defalias 'socks-filter #[514 "\306\211\211\307\310\"\204 \311\312\"\210\307\313\"\262U\203P \314\315\307\315\"\211P\211\262	\262#\210G\316W?\205/\314\317\320H#\210\314\315\316\306O#\210\314\313	#\207	U\206/\nU\206/U\203,\314\315\307\315\"\211P\211\262	\262#\210\307\321\"\262\322\267\202*\323\324\"\205/\314\313\f#\210\314\325\326#\210\314\327#\207G\316W?\205/\330\262GW?\205/\320H\211\331U\203\272 \326\262\314\313\f#\210\314\325#\210\314\327#\207G\332W?\205/\333\334HU\203\346 \332\202 U\203\361 \335\202!U\205G\336W\203\337\202\332HT\262\\\262GW?\205/\314\313\f#\210\314\325\320H#\210\314\327#\207\306\207\fU\207" [socks-state-waiting-for-auth socks-state-submethod-negotiation socks-state-authenticated socks-state-waiting socks-state-connected socks-address-type-v4 nil process-get socks error "socks-filter called on non-SOCKS connection %S" socks-state process-put socks-scratch 2 socks-authtype 1 socks-server-protocol #s(hash-table size 3 test eq rehash-size 1.5 rehash-threshold 0.8125 purecopy t data (http 129 4 155 5 208)) string-search "\n\n" socks-reply 0 socks-response 8 90 4 6 3 16 5 255 socks-address-type-v6 socks-address-type-name] 11 (#$ . 2958)])#@79 If non-nil, overwrite `open-network-stream' function with SOCKSified version.
(defvar socks-override-functions nil (#$ . 4253))
(byte-code "\203\n \301\302\303\304#\210\301\207" [socks-override-functions advice-add open-network-stream :around socks--open-network-stream] 4)#@20 

(fn SERVER-INFO)
(defalias 'socks-open-connection #[257 "\212\306\307\310\306A@\3118$)\306\211\312\313\"\210\314\306\"\210\315\316\317#\210\315\320	#\210\315\321\n#\210\315\322\3238#\210\315\324A@#\210\3238\262\211\325=\204\332 \211\326=\204\332 \211\327=\203\332 \330\331\332\333 #\"\210\334	\"\210\335\321\"\262\fU\203{ \203\310 \336\337!\210\202\310 \nU\203\210 \340\341!\210\202\310 \335\321\"\342)\"\211\205\230 \211AA\205\237 A@\312\306\"\210\203\266 \343!\203\266 !\204\306 \344!\210\340\345\206\302 \346#\210\266\315\320*#\210\315\347\350#\210\312\313\"\210\266\203)\207" [socks-override-functions socks-state-waiting-for-auth socks-authentication-failure socks-version socks-authentication-null socks-debug nil open-network-stream "socks" 2 set-process-filter socks-filter set-process-query-on-exit-flag process-put socks t socks-state socks-authtype socks-server-protocol 3 socks-server-name http 4 5 process-send-string format "%c%s" socks-build-auth-list socks-wait-for-state-change process-get message "No authentication necessary" error "No acceptable authentication methods found" assoc fboundp delete-process "Failed to use auth method: %s (%d)" "Unknown" socks-scratch "" socks-authentication-methods socks-state-authenticated] 12 (#$ . 4533) nil])#@175 Send COMMAND to SOCKS service PROC for proxying ADDRESS and PORT.
When ATYPE indicates an IP, param ADDRESS must be given as raw bytes.

(fn PROC COMMAND ATYPE ADDRESS PORT)
(defalias 'socks-send-command #[1285 "U\204\f 	U\203 \202# \nU\203 \306\307G#\202# \310\311\"\312\211\313\314\"\2043 \310\315	\"\210\316\317#\210\313\320\"\262\211\321\267\202\226 \306\322\n\232\203U \202Z \310\323	\"#\262\202\233 \324\325\326\"\327\330\"$\331 \332R\262\202\233 \324\333	$\324\325\326\"\327\330\"\"Q\262\202\233 \310\334\"\210\335\"\210\336\"\210\337!\210\313\340\"\206\265 \341\fU\204\316 \342!\210\310\343\313\n\340\"\206\312 \3418\"\210\207" [socks-address-type-v4 socks-address-type-v6 socks-address-type-name socks-state-waiting socks-response-success socks-errors format "%c%s" error "Unknown address type: %d" nil process-get socks "socks-send-command called on non-SOCKS connection %S" process-put socks-state socks-server-protocol #s(hash-table size 3 test eq rehash-size 1.5 rehash-threshold 0.8125 purecopy t data (http 71 4 98 5 123)) "CONNECT %s:%d HTTP/1.0\nUser-Agent: Emacs/SOCKS v1.0\n\n" "Unsupported address type for HTTP: %d" unibyte-string ash -8 logand 255 user-full-name " " 0 "Unknown protocol version: %d" process-send-string socks-wait-for-state-change process-status socks-reply 1 delete-process "SOCKS: %s"] 15 (#$ . 5854)])#@76 List of regexps matching hosts that we should not socksify connections to.
(defvar socks-noproxy nil (#$ . 7269))#@21 

(fn HOST SERVICE)
(defalias 'socks-find-route #[514 "	\211\2035 \211@\302H\303=\203  \304@\305\306O\"\203. \306\262\202. \304@\"\203. \306\262\306\262\211A\262\202 \207" [socks-server socks-noproxy 0 33 string-match 1 nil] 8 (#$ . 7388)])
(defvar socks-services-file "/etc/services")
(defvar socks-tcp-services (make-hash-table :size 13 :test 'equal))
(defvar socks-udp-services (make-hash-table :size 13 :test 'equal))
(defalias 'socks-parse-services #[0 "\303!\203\f \304!\204 \305\306\"\210\307	!\210\307\n!\210r\310\311!q\210\312 \210\313!\210eb\210\314\315\316\317#\2038 \320\321!\210\202) eb\210\314\322\316\317#\203J \320\321!\210\202; eb\210\316\211\211\314\323\316\317#\205~ \324\325!\227\262\326\324\327!!\262\324\330!\227\262\331\332\232\203x \n\202y 	#\210\202P \266\203)\207" [socks-services-file socks-tcp-services socks-udp-services file-exists-p file-readable-p error "Could not find services file: %s" clrhash get-buffer-create " *socks-tmp*" erase-buffer insert-file-contents re-search-forward "#.*" nil t replace-match "" "^[ 	\n]+" "^\\([^ 	]+\\)[ 	]+\\([0-9]+\\)/\\([a-z]+\\)" match-string 1 string-to-number 2 3 puthash "udp"] 8])#@72 Return the port # associated with SERVICE.

(fn SERVICE &optional UDP)
(defalias 'socks-find-services-entry #[513 "\302!\303U\203 \304 \210\305\227\203 	\202 \"\207" [socks-tcp-services socks-udp-services hash-table-count 0 socks-parse-services gethash] 5 (#$ . 8570)])#@33 

(fn NAME BUFFER HOST SERVICE)
(defalias 'socks-open-network-stream #[1028 "\301\302\303%)\207" [socks-override-functions t socks--open-network-stream #[128 "\301\302\303\")\207" [socks-override-functions nil apply open-network-stream] 4 "\n\n(fn &rest ARGS)"]] 10 (#$ . 8852)])#@55 

(fn ORIG-FUN NAME BUFFER HOST SERVICE &rest PARAMS)
(defalias 'socks--open-network-stream #[1413 "\205 \304\"\211\204 \305&\207\306!\307\310\"\211\311=\203E \312!\262<\204: \313\314\"\210\305\315\"\262	\202F \n\316\n\n;\203a \317!\206c \313\320\f\"\202c \n%\210\321\322\n#\210\321\323	#\210\321\324#\210\325\326\"\210\327	\205\212 \330\n!\"\210\207" [socks-override-functions socks-address-type-v4 socks-address-type-name socks-connect-command socks-find-route apply socks-open-connection process-get socks-server-protocol 4 socks-nslookup-host error "Could not get IP address for: %s" unibyte-string socks-send-command socks-find-services-entry "Unknown service: %s" process-put socks-buffer socks-host socks-service set-process-filter nil set-process-buffer get-buffer-create] 18 (#$ . 9144)])
(socks-register-authentication-method 2 "Username/Password" 'socks-username/password-auth)
(defconst socks-username/password-auth-version 1)#@17 

(fn PROC STR)
(defalias 'socks-username/password-auth-filter #[514 "\301\302\"\204\f \303\304\"\210\305\306\301\306\"\211P\262#\210\301\306\"G\307W?\2055 \305\310\301\306\"\311H#\210\305\312#\207" [socks-state-authenticated process-get socks error "socks-filter called on non-SOCKS connection %S" process-put socks-scratch 2 socks-password-auth-status 1 socks-state] 8 (#$ . 10138)])#@13 

(fn PROC)
(defalias 'socks-username/password-auth #[257 "\303\304\"\204 \305\306\307	\303\310\"#!\311\312\313#\210\314\315\"\210\316\306\317\n	G	G&\"\210\320\"\210\303\321\"\322U\207" [socks-password socks-username socks-username/password-auth-version process-get socks-state read-passwd format "Password for %s@%s: " socks-server-name process-put socks-scratch "" set-process-filter socks-username/password-auth-filter process-send-string "%c%c%s%c%s" socks-wait-for-state-change socks-password-auth-status 0] 11 (#$ . 10540)])#@13 

(fn PROC)
(defalias 'socks-gssapi-auth #[257 "\300\207" [nil] 2 (#$ . 11091)])#@13 

(fn PROC)
(defalias 'socks-chap-auth #[257 "\300\207" [nil] 2 (#$ . 11177)])#@13 

(fn PROC)
(defalias 'socks-cram-auth #[257 "\300\207" [nil] 2 (#$ . 11261)])
(byte-code "\300\301\302\303\304DD\305\306\307%\207" [custom-declare-variable socks-nslookup-program funcall function #[0 "\300\207" ["nslookup"] 1 ""] "If non-nil then a string naming the nslookup program." :type (choice (const :tag "None" :value nil) string)] 6)#@78 Attempt to resolve the given HOSTNAME using nslookup if possible.

(fn HOST)
(defalias 'socks-nslookup-host #[257 "\203C \301\302\211$\303\304\"\210r\305!q\210\306!\210\307!\310>\204 eb\210\311\312\304\313#\203= \314\224\314\225{\262\315\316\317\320\"\"\262\321p!)\210\207\207" [socks-nslookup-program start-process " *nslookup*" set-process-query-on-exit-flag nil process-buffer accept-process-output process-status (run open) re-search-forward "Name:.*\nAddress\\(es\\)?: *\\([0-9.]+\\)$" t 2 mapcar string-to-number split-string "\\." kill-buffer] 8 (#$ . 11610) "sHost:  "])
(provide 'socks)
