| // 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.device; |
| 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 |
| protocol Tunnel { |
| /// Forwards a TCP port on the host to the target address, from the target node. |
| ForwardPort(struct { |
| target string:<fuchsia.device.DEVICE_NAME_MAX>; |
| host_address fuchsia.net.SocketAddress; |
| target_address fuchsia.net.SocketAddress; |
| }) -> (struct {}) error TunnelError; |
| |
| /// Forwards a TCP port on the target to the host address, from the host. |
| ReversePort(struct { |
| target string:<fuchsia.device.DEVICE_NAME_MAX>; |
| host_address fuchsia.net.SocketAddress; |
| target_address fuchsia.net.SocketAddress; |
| }) -> (struct {}) error TunnelError; |
| }; |