Skip to content

Gio.ProxyAddress

class — extends InetSocketAddress, SocketConnectable

A InetSocketAddress representing a connection via a proxy server.

Constructors

new

@classmethod
def new(cls, inetaddr: InetAddress, port: int, protocol: str, dest_hostname: str, dest_port: int, username: str | None = ..., password: str | None = ...) -> SocketAddress

Creates a new ProxyAddress for inetaddr with protocol that should tunnel through dest_hostname and dest_port.

(Note that this method doesn't set the ProxyAddress:uri or ProxyAddress:destination-protocol fields; use g_object_new() directly if you want to set those.)

Parameters:

  • inetaddr — The proxy server InetAddress.
  • port — The proxy server port.
  • protocol — The proxy protocol to support, in lower case (e.g. socks, http).
  • dest_hostname — The destination hostname the proxy should tunnel to.
  • dest_port — The destination port to tunnel to.
  • username — The username to authenticate to the proxy server (or None).
  • password — The password to authenticate to the proxy server (or None).

Methods

get_destination_hostname

def get_destination_hostname(self) -> str

Gets proxy's destination hostname; that is, the name of the host that will be connected to via the proxy, not the name of the proxy itself.

get_destination_port

def get_destination_port(self) -> int

Gets proxy's destination port; that is, the port on the destination host that will be connected to via the proxy, not the port number of the proxy itself.

get_destination_protocol

def get_destination_protocol(self) -> str

Gets the protocol that is being spoken to the destination server; eg, "http" or "ftp".

get_password

def get_password(self) -> str | None

Gets proxy's password.

get_protocol

def get_protocol(self) -> str

Gets proxy's protocol. eg, "socks" or "http"

get_uri

def get_uri(self) -> str | None

Gets the proxy URI that proxy was constructed from.

get_username

def get_username(self) -> str | None

Gets proxy's username.

Properties

destination_hostname

destination_hostname: str  # read/write

The proxy destination hostname.

destination_port

destination_port: int  # read/write

The proxy destination port.

destination_protocol

destination_protocol: str  # read/write

The protocol being spoke to the destination host, or None if the ProxyAddress doesn't know.

password

password: str  # read/write

The proxy password.

protocol

protocol: str  # read/write

The proxy protocol.

uri

uri: str  # read/write

The URI string that the proxy was constructed from (or None if the creator didn't specify this).

username

username: str  # read/write

The proxy username.