Skip to content

SSH connection with HTTP Proxy #568

Closed Answered by ronf
JCHacking asked this question in Q&A
May 24, 2023 · 4 comments · 4 replies
Discussion options

You must be logged in to vote

The types you're using here (and those in #429) are not quite right. Those types made sense for when tunneling SSH over itself, but not when doing so with transports and protocols coming from asyncio.

One version of this which works for me in terms of typing is:

import asyncio
import asyncssh
import ssl

from typing import Optional, Tuple, Type


class HTTPConnectorTunnel:
    def __init__(self, proxy_host: str, proxy_port: int,
                 ssl_context: Optional[ssl.SSLContext] = None) -> None:
        self._proxy_host = proxy_host
        self._proxy_port = proxy_port
        self._ssl_context = ssl_context

    async def create_connection(
            self, protocol_factory: Type[a…

Replies: 4 comments 4 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
4 replies
@ronf
Comment options

@JCHacking
Comment options

@ronf
Comment options

Answer selected by JCHacking
@JCHacking
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants