HOME


sh-3ll 1.0
DIR:/usr/share/emacs/26.1/lisp/net/
Upload File :
Current File : //usr/share/emacs/26.1/lisp/net/socks.elc
;ELC
;;; Compiled
;;; in Emacs version 26.1
;;; with all optimizations.

;;; This file uses dynamic docstrings, first added in Emacs 19.29.

;;; This file does not contain utf-8 non-ASCII characters,
;;; and so can be loaded in Emacs versions earlier than 23.

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


(byte-code "\300\301!\210\302\303\304\"\210\305\306\307\310\311\312\313\314\315\316&	\210\317\320\321\322\315\306\323\324&\207" [require custom defalias socks-split-string split-string custom-declare-group socks nil "SOCKS support." :version "22.2" :prefix "socks-" :group processes custom-declare-variable socks-server (list "Default server" "socks" 1080 5) #1="" :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-connections (make-hash-table :size 13))
(defvar socks-authentication-methods nil)
(defvar socks-username (user-login-name))
(defvar socks-password nil)
(defalias 'socks-register-authentication-method #[(id desc callback) "	\236\211\203\n\fB\241\202\fBB	B\211)\207" [id socks-authentication-methods old desc callback] 4])
(defalias 'socks-unregister-authentication-method #[(id) "	\236\211\205\303\n	\"\211)\207" [id socks-authentication-methods old delq] 4])
(socks-register-authentication-method 0 "No authentication" 'identity)
(defalias 'socks-build-auth-list #[nil "\303\304\305\306\307\n!\"\210\310\311	#*\207" [retval num socks-authentication-methods 0 "" mapc #[(x) "\303AA!\205\304\305	@#\nT\211\207" [x retval num fboundp format "%s%c"] 4] reverse format "%c%s"] 4])
(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)
(defalias 'socks-wait-for-state-change '(macro . #[(proc htable cur-state) "\303\304\305\306\307E	E\310\311\nD\312BBE\313\n\314BBE\207" [htable cur-state proc while and = gethash 'state memq process-status ('(run open)) accept-process-output (socks-timeout)] 6]))
(defalias 'socks-filter #[(proc string) "\306	\"\307\211\211\211\204\310\311\"\210\306\304
\"\211U\203V\312\313\306\313
\"P
#\210\306\313
\"\211G\314W?\205N\312\315\316H
#\210\312\313\314\307O
#\210\312\304 
#\202N\f U\206N\f!U\206N\f\"U\203J\312\313\306\313
\"P
#\210\306\313
\"\306\317
\"\211\320\267\202F\321\322\"\205N\312\304#
#\210\312\323\324
#\210\312\325
#\202NG\314W?\205N\326G\nW?\205N\316H\211\327U\203\311\324\312\304#
#\210\312\323
#\210\312\325
#)\202NG\330W?\205N\331\332H$U\203\371\330\202\"\332H%U\203\333\202\"\332H&U\205\"G\334W\203\335\202\"\330HT\\G\nW?\205N\312\304#
#\210\312\323\316H
#\210\312\325
#\202N\307\202N\f#U,\207" [proc socks-connections desired-len version state info gethash nil error "socks-filter called on non-SOCKS connection %S" puthash scratch 2 authtype 1 server-protocol #s(hash-table size 3 test equal rehash-size 1.5 rehash-threshold 0.8125 purecopy t data (http 136 4 166 5 225)) string-match "
\n
\n" reply 0 response 8 90 4 6 3 16 5 255 socks-state-waiting-for-auth string socks-state-submethod-negotiation socks-state-authenticated socks-state-waiting socks-state-connected socks-address-type-v4 socks-address-type-v6 socks-address-type-name] 7])
#@86 Whether to overwrite the `open-network-stream' function with the SOCKSified
version.
(defvar socks-override-functions nil (#$ . 4623))
(byte-code "\301\302!\210\303\304!\204\305\304\306K\"\210\203\305\306\307\"\210\301\207" [socks-override-functions require network-stream fboundp socks-original-open-network-stream defalias open-network-stream socks-open-network-stream] 3)
(defalias 'socks-open-connection #[(server-info) "\212\306\307\310A@\3118$\312\313\314\"\310\211\315\f\316\"\210\317\f\310\"\210\320\f
#\210\320\321)#\210\320\302*#\210\320\322\3238#\210\320\324A@#\210\3238\211\325\232\204\375	\326\232\204\375	\327\232\203\375\330\f\331\332+\333 #\"\210\334\321\")U\203\335\f!\336>\203\337\f,\"\210\202d\334\302\"\211-U\203\227.\203\361\340\341!\210\202\361\n*U\203\245\342\343!\210\202\361\334\302\"/\344/0\"\2111\205\2731AA21\205\3061A@3\315\f\310\"\2102\203\340\3452!\203\3402\f!\204\360\346\f!\210\342\3473\206\354\350/#\210,\320\3214#\210\315\f\316\"\210\f-\207" [server-info version authtype info proc socks-connections socks-original-open-network-stream "socks" nil 2 make-hash-table :size 13 set-process-filter socks-filter set-process-query-on-exit-flag puthash state server-protocol 3 server-name http 4 5 process-send-string format "%c%s" socks-build-auth-list gethash process-status (run open) accept-process-output message "No authentication necessary" error "No acceptable authentication methods found" assoc fboundp delete-process "Failed to use auth method: %s (%d)" "Unknown" socks-state-waiting-for-auth socks-authentication-failure socks-version socks-timeout socks-authentication-null socks-debug auth-type socks-authentication-methods auth-handler auth-func auth-desc socks-state-authenticated] 7 nil nil])
(defalias 'socks-send-command #[(proc command atype address port) "	U\204\f\nU\203\202#\fU\203\306\307G#\202#\310\311\"\312
$\"\313\211%&'('\204<\310\314
\"\210\315\316)'#\210\312\317'\"\211%\320\267\202\260\306\321\f\232\203]\202a\310\322\"*#&\202\266\323\306\324%+\325*\326\"*\325\211*\326\"\327\"Z(\330 \331&!&\202\266\323\306\332%+\331(\325*\326\"*\325\211*\326\"\327\"Z&!&\202\266\310\333%\"\210\334
&\"\210\312\316'\")U\203\330\335
!\336>\203\330\337
,\"\210\202\274\335
!\210\312\340'\"\206\345\341-U\204\377\342
!\210\310\343\312\340'\"\206\372\341.8\"\210
,\207" [atype socks-address-type-v4 socks-address-type-v6 address socks-address-type-name proc format "%c%s" error "Unknown address type: %d" gethash nil "socks-send-command called on non-SOCKS connection %S" puthash state server-protocol #s(hash-table size 3 test equal rehash-size 1.5 rehash-threshold 0.8125 purecopy t data (http 81 4 105 5 141)) "CONNECT %s:%d HTTP/1.0
\nUser-Agent: Emacs/SOCKS v1.0
\n
\n" "Unsupported address type for HTTP: %d" string-make-unibyte "%c%c%c%c%s%s%c" lsh -8 8 user-full-name 0 "%c%c%c%c%s%c%c" "Unknown protocol version: %d" process-send-string process-status (run open) accept-process-output reply 1 delete-process "SOCKS: %s" socks-connections version request info addr socks-state-waiting port command socks-timeout socks-response-success socks-errors] 15])
#@75 List of regexps matching hosts that we should not socksify connections to
(defvar socks-noproxy nil (#$ . 7865))
(defalias 'socks-find-route #[(host service) "	\n\2034\n@\305H\306=\203!\307\n@\310\311O\f\"\203-\311\202-\307\n@\f\"\203-\311\211\nA\211\204*\207" [socks-server socks-noproxy noproxy route host 0 33 string-match 1 nil] 5])
(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 #[nil "\306!\203\f\307!\204\310\311\"\210\312	!\210\312\n!\210r\313\314!q\210\315 \210\316!\210eb\210\317\320\321\322#\2038\323\324!\210\202)eb\210\317\325\321\322#\203J\323\324!\210\202;eb\210\321\211\211\317\326\321\322#\205~\327\330!\227\331\327\332!!\327\333!\227\334
\f\335\232\203x\n\202y	#\210\202S,\207" [socks-services-file socks-tcp-services socks-udp-services type port name 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"] 5])
#@44 Return the port # associated with SERVICE.
(defalias 'socks-find-services-entry #[(service &optional udp) "\304!\305U\203\306 \210\307	\227\n\203\202\"\207" [socks-tcp-services service udp socks-udp-services hash-table-count 0 socks-parse-services gethash] 3 (#$ . 9149)])
(defalias 'socks-open-network-stream #[(name buffer host service) "\306	\"\307\211\307\211\n\204\310	$\202\223\311\n!\312\"\312\313\f\"\211\314\267\202M\315!\211<\204@\316\317\"\210\320\321\322#\202Q\323 	;\203j\324	!\206k\316\325	\"\202k	%\210\326\327\f#\210\326\300\f#\210\326\301\f#\210\330\307\"\210\331\205\220\332!\"\210-\207" [host service route proc info version socks-find-route nil socks-original-open-network-stream socks-open-connection gethash server-protocol #s(hash-table size 1 test equal rehash-size 1.5 rehash-threshold 0.8125 purecopy t data (4 50)) socks-nslookup-host error "Could not get IP address for: %s" apply format "%c%c%c%c" socks-send-command socks-find-services-entry "Unknown service: %s" puthash buffer set-process-filter set-process-buffer get-buffer-create atype name socks-connections socks-address-type-v4 socks-address-type-name socks-connect-command] 9])
(socks-register-authentication-method 2 "Username/Password" 'socks-username/password-auth)
(defconst socks-username/password-auth-version 1)
(defalias 'socks-username/password-auth-filter #[(proc str) "\305	\"\211\204\306\307\"\210\310\311\305\311\n\"P\n#\210\305\311\n\"G\312W?\2054\310\313\305\311\n\"\314H\n#\210\310\315\f\n#)\207" [proc socks-connections info str socks-state-authenticated gethash error "socks-filter called on non-SOCKS connection %S" puthash scratch 2 password-auth-status 1 state] 6])
(defalias 'socks-username/password-auth #[(proc) "\306	\"\306\303\n\"\f\204\307\310\311
\306\312\n\"#!\313\314\315\n#\210\316\317\"\210\320\310\321
G
\fG\f&\"\210\306\303\n\"U\203N\322!\323>\203N\324\"\210\2024\306\325\n\"\326U*\207" [proc socks-connections info state socks-password socks-username gethash read-passwd format "Password for %s@%s: " server-name puthash scratch "" set-process-filter socks-username/password-auth-filter process-send-string "%c%c%s%c%s" process-status (run open) accept-process-output password-auth-status 0 socks-username/password-auth-version socks-timeout] 9])
(defalias 'socks-gssapi-auth #[(proc) "\300\207" [nil] 1])
(defalias 'socks-chap-auth #[(proc) "\300\207" [nil] 1])
(defalias 'socks-cram-auth #[(proc) "\300\207" [nil] 1])
#@55 If non-NIL then a string naming the nslookup program.
(custom-declare-variable 'socks-nslookup-program "nslookup" '(#$ . 11691) :type '(choice (const :tag "None" :value nil) string) :group 'socks)
#@67 Attempt to resolve the given HOSTNAME using nslookup if possible.
(defalias 'socks-nslookup-host #[(host) "\203E\304\305\211	$	\306\307\"\210r\310!q\210\311!\210\312!\313>\204eb\210\314\315\307\316#\203=\317\224\317\225{\320\321\322\n\323\"\"\324p!\210)\n*\207	\207" [socks-nslookup-program host res proc 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 socks-split-string "\\." kill-buffer] 5 (#$ . 11894) "sHost:  "])
(provide 'socks)