| // Copyright 2021 The Fuchsia Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| library fuchsia.developer.ffx; |
| using fuchsia.developer.remotecontrol as rc; |
| using fuchsia.net; |
| |
| type TunnelError = strict enum { |
| /// Could not listen on the port from which we were attempting to forward. |
| COULD_NOT_LISTEN = 1; |
| /// Could not connect to the target to establish a tunnel. |
| TARGET_CONNECT_FAILED = 2; |
| }; |
| |
| @discoverable |
| closed protocol Tunnel { |
| /// Forwards a TCP port on the host to the target address, from the target node. |
| strict ForwardPort(struct { |
| target string:<rc.NODE_NAME_MAX>; |
| host_address fuchsia.net.SocketAddress; |
| target_address fuchsia.net.SocketAddress; |
| }) -> () error TunnelError; |
| |
| /// Forwards a TCP port on the target to the host address, from the host. |
| strict ReversePort(struct { |
| target string:<rc.NODE_NAME_MAX>; |
| host_address fuchsia.net.SocketAddress; |
| target_address fuchsia.net.SocketAddress; |
| }) -> () error TunnelError; |
| }; |