Exemplo n.º 1
0
  def Run(self, args):
    project, zone, instance, interface, port = self._GetTargetArgs(args)
    local_host, local_port = self._GetLocalHostPort(args)

    iap_tunnel_helper = iap_tunnel.IapTunnelProxyServerHelper(
        args, project, zone, instance, interface, port, local_host, local_port)
    iap_tunnel_helper.StartProxyServer()
Exemplo n.º 2
0
    def Run(self, args):
        if args.listen_on_stdin and args.IsSpecified('local_host_port'):
            raise calliope_exceptions.ConflictingArgumentsException(
                '--listen-on-stdin', '--local-host-port')
        project, zone, instance, interface, port = self._GetTargetArgs(args)

        if args.listen_on_stdin:
            iap_tunnel_helper = iap_tunnel.IapTunnelStdinHelper(
                args, project, zone, instance, interface, port)
            iap_tunnel_helper.Run()
        else:
            local_host, local_port = self._GetLocalHostPort(args)
            iap_tunnel_helper = iap_tunnel.IapTunnelProxyServerHelper(
                args, project, zone, instance, interface, port, local_host,
                local_port)
            iap_tunnel_helper.StartProxyServer()
    def _CreateIapTunnelHelper(self, args, target):

        if args.listen_on_stdin:
            iap_tunnel_helper = iap_tunnel.IapTunnelStdinHelper(
                args, target.project)
        else:
            local_host, local_port = self._GetLocalHostPort(args)
            check_connection = True
            if hasattr(args, 'iap_tunnel_disable_connection_check'):
                check_connection = not args.iap_tunnel_disable_connection_check
            iap_tunnel_helper = iap_tunnel.IapTunnelProxyServerHelper(
                args, target.project, local_host, local_port, check_connection)

        if target.host:
            iap_tunnel_helper.ConfigureForHost(target.region, target.network,
                                               target.host, target.port,
                                               target.dest_group)
        else:
            iap_tunnel_helper.ConfigureForInstance(target.zone,
                                                   target.instance,
                                                   target.interface,
                                                   target.port)
        return iap_tunnel_helper