TsgcWebSocketProxyServer › 属性 › Bindings
代理监听传入下游 WebSocket 客户端的 IP/端口对集合。
property Bindings: TIdSocketHandles read GetBindings write SetBindings;
—(空;代理在所有接口上回退到 Port)
每个 IP/Port 组合添加一条代理必须监听的条目。每个条目暴露 IP、Port 和 IPVersion;当集合为空时,代理绑定到 Port 上的所有接口。使用 Bindings 从同一个代理实例同时暴露普通端点和 TLS 端点,同时将所有流量转发到 Proxy 中定义的单个上游服务器,或将代理限制到一个物理接口。如果计划在重新启动之前重新分配监听端点,请在停止代理后调用 Bindings.Clear()。
oProxy := TsgcWebSocketProxyServer.Create(nil);
With oProxy.Bindings.Add do
begin
IP := '127.0.0.1';
Port := 80;
end;
With oProxy.Bindings.Add do
begin
IP := '127.0.0.1';
Port := 443;
end;
oProxy.Proxy.Host := 'upstream.example.com';
oProxy.Proxy.Port := 8080;
oProxy.Active := true;