日本熟妇hd丰满老熟妇,中文字幕一区二区三区在线不卡 ,亚洲成片在线观看,免费女同在线一区二区

agent代理

更新時間:

agent代理是阿里云iot研發的一款高安全等級的網絡代理工具,有效將本地服務通過反向代理通道與云端服務處于一個調用平面,方便開發者在云測和本地服務進行聯動。

agent代理架構圖

image.jpgimage.jpg

Backend-Agent端

遠程Agent啟動目前支持兩種方式

代碼模式

Maven坐標

  <dependency>
       <groupId>com.aliyun.iotx</groupId>
       <artifactId>iotx-edge-tunnel-core</artifactId>
       <version>1.0.0-SNAPSHOT</version>
  </dependency>

啟動demo

package yourpackage;

import com.aliyun.iotx.edge.tunnel.core.backend.BackendBootstrap;
import com.aliyun.iotx.edge.tunnel.core.common.model.AuthType;
import io.netty.channel.ChannelFuture;

@SuppressWarnings("all")
public class ApplicationBackendDemo {

    private static final String appKey = "<appKey>";
    private static final String appSecret = "<appSecret>";

    public static void main(String[] args) throws Exception {
        BackendBootstrap bootstrap = new BackendBootstrap()
                .authType(AuthType.APPLICATION.getType())
                .appKey(appKey)
                .appSecret(appSecret);

        // 阻塞直到連接斷開
        ChannelFuture closeFuture = bootstrap.start();
    }
}

JAR模式

JAR包下載地址

https://edge-service-agent.oss-cn-shanghai.aliyuncs.com/iotx-remote-debug.zip

配置修改:
{
    "serverUrl":"wss://backend-iotx-remote-debug.aliyun.com:443",
    "authType":"application",
    "appKey": "請輸入appkey",
    "appSecret":"請輸入appSecret"
}
運行啟動腳本
linux:start_up.sh
windows:start_up.bat

Frontend-Agent端

Maven坐標

<dependency>
    <groupId>com.aliyun.iotx</groupId>
    <artifactId>iotx-api-gateway-client</artifactId>
    <version>1.0.6-SNAPSHOT</version>
</dependency>
<dependency>
    <groupId>com.aliyun.iotx</groupId>
    <artifactId>iotx-edge-tunnel-core</artifactId>
    <version>1.0.0-SNAPSHOT</version>
</dependency>

啟動代碼

package yourpackage;

import com.alibaba.cloudapi.sdk.model.ApiResponse;
import com.alibaba.fastjson.JSON;
import com.aliyun.iotx.api.client.IoTApiClientBuilderParams;
import com.aliyun.iotx.api.client.IoTApiRequest;
import com.aliyun.iotx.api.client.SyncApiClient;
import com.aliyun.iotx.edge.tunnel.core.common.model.AuthType;
import com.aliyun.iotx.edge.tunnel.core.frontend.FrontendBootstrap;
import io.netty.channel.ChannelFuture;
import org.apache.commons.collections4.MapUtils;

import java.io.UnsupportedEncodingException;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;

@SuppressWarnings("all")
public class ApplicationFrontendHsfDemo {

    private static final String appKey = "<appKey>";
    private static final String appSecret = "<appSecret>";
    private static final int frontendServerPort = 9999; // frontend-agent在本機暴露哪個端口進行代理
    private static final String backendServiceIp = "將數據流轉到 backend-agent 所在網絡的哪個ip"; // 不填,默認為localhost
    private static final int backendServicePort = 3306; // 將數據流轉到 backend-agent 所在網絡中 ip為 backendServiceIp 的機器的哪個端口,默認22端口
    private static String host = "api.link.aliyun.com";
    private static String path = "/app/tunnel/token/get";
    private  static SyncApiClient syncApiClient;

    public static void main(String[] args) throws Exception {
        initApiClient();
        FrontendBootstrap frontendBootstrap = new FrontendBootstrap()
                .authType(AuthType.APPLICATION.getType())
                .appKey(appKey)
                .frontendServerPort(frontendServerPort)
                .backendServiceIp(backendServiceIp)
                .backendServicePort(backendServicePort)// 將數據流路由到backend測的哪個端口
                .tenantTokenLoader(()->getTenantToken());

        ChannelFuture closeFuture = frontendBootstrap.start();

    }

    public static void initApiClient() {
        IoTApiClientBuilderParams ioTApiClientBuilderParams =
                new IoTApiClientBuilderParams();
        ioTApiClientBuilderParams.setAppKey(appKey);
        ioTApiClientBuilderParams.setAppSecret(appSecret);
        syncApiClient = new SyncApiClient(ioTApiClientBuilderParams);
    }

    private static String getTenantToken() {
        IoTApiRequest request = new IoTApiRequest();
        String uuid = UUID.randomUUID().toString();// 設置請求ID
        String id = uuid.replace("-", "");
        request.setId(id);
        request.setApiVer("1.0.0");// 設置API版本號
        Map<String, String> headers = new HashMap<String, String>(8);
        ApiResponse response = null;
        try {
            response = syncApiClient.postBody(host, path, request, true, headers);// 設置請求參數域名、path、request , isHttps, headers
            String result = new String(response.getBody(), "UTF-8");
            if (result != null) {
                Map map = JSON.parseObject(result);
                Map dataMap = (Map) map.get("data");
                String tenantToken = MapUtils.getString(dataMap, "tenantToken");
                return tenantToken;
            }

        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
        return null;
    }
}