PortForwardStrategy
public class PortForwardStrategy implements ConnectionStrategy
源码Source
io/agentscope/extensions/sandbox/kubernetes/client/internal/strategy/PortForwardStrategy.java:34–117Port Forward Strategy,在隔离环境中安全执行代码和工具。位于 io.agentscope.extensions.sandbox.kubernetes.client.internal.strategy 包,实现 ConnectionStrategy。核心成员包括 connect、close、PortForwardStrategy。
Port-forward connection strategy — establishes a fabric8 port-forward tunnel to the sandbox-router service for development / out-of-cluster mode.
构造器摘要Constructor Summary
| 构造器Constructor | 说明Description |
|---|---|
public PortForwardStrategy(KubernetesClient client, LocalTunnelConnectionConfig config) | 初始化 `PortForwardStrategy` 实例。 Creates a new instance. |
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
public String connect() throws Exception | 建立连接并完成初始化。 Returns the connect. |
public void close() | 关闭连接并释放相关资源。 Releases resources and connections. |
构造器详情Constructor Detail
PortForwardStrategy
public PortForwardStrategy(KubernetesClient client, LocalTunnelConnectionConfig config)
初始化 PortForwardStrategy 实例。
Creates a new instance.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
client | KubernetesClient | 客户端(类型 `KubernetesClient`)。The client. |
config | LocalTunnelConnectionConfig | 配置对象(类型 `LocalTunnelConnectionConfig`)。The config. |
源码Source
io/agentscope/extensions/sandbox/kubernetes/client/internal/strategy/PortForwardStrategy.java:43–46方法详情Method Detail
connect
public String connect() throws Exception
建立连接并完成初始化。
Returns the connect.
String返回字符串结果。Returns a string.
Exception可能抛出 `Exception`。Thrown when the operation cannot be completed.
源码Source
io/agentscope/extensions/sandbox/kubernetes/client/internal/strategy/PortForwardStrategy.java:48–80close
public void close()
关闭连接并释放相关资源。
Releases resources and connections.
源码Source
io/agentscope/extensions/sandbox/kubernetes/client/internal/strategy/PortForwardStrategy.java:82–93