Ejemplo n.º 1
0
 def configure(self, updated):
     if not self.is_running:
         return
     if "mode" in updated and ctx.options.mode == "transparent":  # pragma: no cover
         platform.init_transparent_mode()
     if any(x in updated for x in ["server", "listen_host", "listen_port"]):
         asyncio.create_task(self.refresh_server())
Ejemplo n.º 2
0
 def __init__(self, config: ProxyConfig):
     """
         Raises ServerException if there's a startup problem.
     """
     self.config = config
     try:
         super().__init__(
             (config.options.listen_host, config.options.listen_port))
         if config.options.mode == "transparent":
             platform.init_transparent_mode()
     except socket.error as e:
         raise exceptions.ServerException('Error starting proxy server: ' +
                                          repr(e))
     self.channel = None
Ejemplo n.º 3
0
 def __init__(self, config: config.ProxyConfig) -> None:
     """
         Raises ServerException if there's a startup problem.
     """
     self.config = config
     try:
         super().__init__(
             (config.options.listen_host, config.options.listen_port))
         if config.options.mode == "transparent":
             platform.init_transparent_mode()
     except Exception as e:
         raise exceptions.ServerException('Error starting proxy server: ' +
                                          repr(e)) from e
     self.channel = None  # type: controller.Channel
Ejemplo n.º 4
0
 def __init__(self, config: ProxyConfig):
     """
         Raises ServerException if there's a startup problem.
     """
     self.config = config
     try:
         super().__init__(
             (config.options.listen_host, config.options.listen_port)
         )
         if config.options.mode == "transparent":
             platform.init_transparent_mode()
     except Exception as e:
         raise exceptions.ServerException(
             'Error starting proxy server: ' + repr(e)
         ) from e
     self.channel = None
Ejemplo n.º 5
0
 def configure(self, updated):
     if "stream_large_bodies" in updated:
         try:
             human.parse_size(ctx.options.stream_large_bodies)
         except ValueError:
             raise exceptions.OptionsError(f"Invalid stream_large_bodies specification: "
                                           f"{ctx.options.stream_large_bodies}")
     if "body_size_limit" in updated:
         try:
             human.parse_size(ctx.options.body_size_limit)
         except ValueError:
             raise exceptions.OptionsError(f"Invalid body_size_limit specification: "
                                           f"{ctx.options.body_size_limit}")
     if not self.is_running:
         return
     if "mode" in updated and ctx.options.mode == "transparent":  # pragma: no cover
         platform.init_transparent_mode()
     if any(x in updated for x in ["server", "listen_host", "listen_port"]):
         asyncio.create_task(self.refresh_server())