Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
Python Proxy
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Nationellt superdatorcentrum
Python Proxy
Commits
2e18d25b
Commit
2e18d25b
authored
4 years ago
by
qwj
Browse files
Options
Downloads
Patches
Plain Diff
ssh reconnect
parent
4965c8df
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
pproxy/server.py
+18
-12
18 additions, 12 deletions
pproxy/server.py
with
18 additions
and
12 deletions
pproxy/server.py
+
18
−
12
View file @
2e18d25b
...
...
@@ -615,7 +615,7 @@ class ProxySSH(ProxySimple):
writer
.
get_extra_info
=
dict
(
peername
=
remote_addr
,
sockname
=
remote_addr
).
get
return
reader
,
writer
async
def
wait_ssh_connection
(
self
,
local_addr
=
None
,
family
=
0
,
tunnel
=
None
):
if
self
.
sshconn
is
not
None
:
if
self
.
sshconn
is
not
None
and
not
self
.
sshconn
.
cancelled
()
:
if
not
self
.
sshconn
.
done
():
await
self
.
sshconn
else
:
...
...
@@ -633,18 +633,24 @@ class ProxySSH(ProxySimple):
conn
=
await
asyncssh
.
connect
(
host
=
self
.
host_name
,
port
=
self
.
port
,
local_addr
=
local_addr
,
family
=
family
,
x509_trusted_certs
=
None
,
known_hosts
=
None
,
username
=
username
,
password
=
password
,
client_keys
=
client_keys
,
keepalive_interval
=
60
,
tunnel
=
tunnel
)
self
.
sshconn
.
set_result
(
conn
)
async
def
wait_open_connection
(
self
,
host
,
port
,
local_addr
,
family
,
tunnel
=
None
):
await
self
.
wait_ssh_connection
(
local_addr
,
family
,
tunnel
)
conn
=
self
.
sshconn
.
result
()
if
isinstance
(
self
.
jump
,
ProxySSH
):
reader
,
writer
=
await
self
.
jump
.
wait_open_connection
(
host
,
port
,
None
,
None
,
conn
)
else
:
host
,
port
=
self
.
jump
.
destination
(
host
,
port
)
if
self
.
jump
.
unix
:
reader
,
writer
=
await
conn
.
open_unix_connection
(
self
.
jump
.
bind
)
try
:
await
self
.
wait_ssh_connection
(
local_addr
,
family
,
tunnel
)
conn
=
self
.
sshconn
.
result
()
if
isinstance
(
self
.
jump
,
ProxySSH
):
reader
,
writer
=
await
self
.
jump
.
wait_open_connection
(
host
,
port
,
None
,
None
,
conn
)
else
:
reader
,
writer
=
await
conn
.
open_connection
(
host
,
port
)
reader
,
writer
=
self
.
patch_stream
(
reader
,
writer
,
host
,
port
)
return
reader
,
writer
host
,
port
=
self
.
jump
.
destination
(
host
,
port
)
if
self
.
jump
.
unix
:
reader
,
writer
=
await
conn
.
open_unix_connection
(
self
.
jump
.
bind
)
else
:
reader
,
writer
=
await
conn
.
open_connection
(
host
,
port
)
reader
,
writer
=
self
.
patch_stream
(
reader
,
writer
,
host
,
port
)
return
reader
,
writer
except
Exception
as
ex
:
if
not
self
.
sshconn
.
done
():
self
.
sshconn
.
set_exception
(
ex
)
self
.
sshconn
=
None
raise
async
def
start_server
(
self
,
args
,
stream_handler
=
stream_handler
,
tunnel
=
None
):
if
type
(
self
.
jump
)
is
ProxyDirect
:
raise
Exception
(
'
ssh server mode unsupported
'
)
...
...
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