Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
gajim
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Weblate
gajim
Commits
9ec00eda
Commit
9ec00eda
authored
16 years ago
by
steve-e
Browse files
Options
Downloads
Patches
Plain Diff
Document consturctor in proxy_connector.py
parent
1e006745
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/common/xmpp/proxy_connectors.py
+16
-11
16 additions, 11 deletions
src/common/xmpp/proxy_connectors.py
with
16 additions
and
11 deletions
src/common/xmpp/proxy_connectors.py
+
16
−
11
View file @
9ec00eda
...
...
@@ -33,7 +33,19 @@ class ProxyConnector:
'''
def
__init__
(
self
,
send_method
,
onreceive
,
old_on_receive
,
on_success
,
on_failure
,
xmpp_server
,
proxy_creds
=
(
None
,
None
)):
'''
Creates proxy connector, starts connecting immediately and gives control
back to transport afterwards.
:param send_method: transport send method
:param onreceive: method to set on_receive callbacks
:param old_on_receive: on_receive callback that should be set when
proxy connection was successful
:param on_success: called after proxy connection was successfully opened
:param on_failure: called when errors occured while connecting
:param xmpp_server: tuple of (hostname, port)
:param proxy_creds: tuple of (proxy_user, proxy_credentials)
'''
self
.
send
=
send_method
self
.
onreceive
=
onreceive
self
.
old_on_receive
=
old_on_receive
...
...
@@ -46,7 +58,7 @@ class ProxyConnector:
self
.
start_connecting
()
def
start_connecting
(
self
):
raise
NotImplementedE
xception
()
raise
NotImplementedE
rror
def
connecting_over
(
self
):
self
.
onreceive
(
self
.
old_on_receive
)
...
...
@@ -93,7 +105,6 @@ class HTTPCONNECTConnector(ProxyConnector):
self
.
connecting_over
()
class
SOCKS5Connector
(
ProxyConnector
):
'''
SOCKS5 proxy connection class. Allows to use SOCKS5 proxies with
...
...
@@ -169,7 +180,7 @@ class SOCKS5Connector(ProxyConnector):
# # Resolve locally
# self.ipaddr = socket.inet_aton(socket.gethostbyname(self.xmpp_server[0]))
# req = req + "\x01" + ipaddr
req
=
req
+
struct
.
pack
(
"
>H
"
,
self
.
xmpp_server
[
1
])
req
=
req
+
struct
.
pack
(
"
>H
"
,
self
.
xmpp_server
[
1
])
self
.
onreceive
(
self
.
_on_req_sent
)
self
.
send
(
req
)
...
...
@@ -213,10 +224,4 @@ class SOCKS5Connector(ProxyConnector):
return
self
.
connecting_over
()
# vim: se ts=3:
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment