mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-03 04:10:27 +08:00
支持HTTPS的API节点
This commit is contained in:
@@ -2,6 +2,7 @@ package rpc
|
||||
|
||||
import (
|
||||
"context"
|
||||
"crypto/tls"
|
||||
"encoding/base64"
|
||||
"errors"
|
||||
"github.com/TeaOSLab/EdgeAdmin/internal/configs"
|
||||
@@ -12,6 +13,7 @@ import (
|
||||
"github.com/iwind/TeaGo/maps"
|
||||
"github.com/iwind/TeaGo/rands"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/credentials"
|
||||
"google.golang.org/grpc/metadata"
|
||||
"net/url"
|
||||
"time"
|
||||
@@ -39,8 +41,9 @@ func NewRPCClient(apiConfig *configs.APIConfig) (*RPCClient, error) {
|
||||
if u.Scheme == "http" {
|
||||
conn, err = grpc.Dial(u.Host, grpc.WithInsecure())
|
||||
} else if u.Scheme == "https" {
|
||||
// TODO 暂不支持HTTPS
|
||||
conn, err = grpc.Dial(u.Host)
|
||||
conn, err = grpc.Dial(u.Host, grpc.WithTransportCredentials(credentials.NewTLS(&tls.Config{
|
||||
InsecureSkipVerify: true,
|
||||
})))
|
||||
} else {
|
||||
return nil, errors.New("parse endpoint failed: invalid scheme '" + u.Scheme + "'")
|
||||
}
|
||||
|
||||
@@ -2,6 +2,6 @@
|
||||
<menu-item href="/api">节点列表</menu-item>
|
||||
<span class="item">|</span>
|
||||
<menu-item :href="'/api/node?nodeId=' + node.id" code="index">"{{node.name}}"详情</menu-item>
|
||||
<menu-item :href="'/api/node/update?nodeId=' + node.id" code="update">修改节点</menu-item>
|
||||
<menu-item :href="'/api/node/install?nodeId=' + node.id" code="install">安装节点</menu-item>
|
||||
<menu-item :href="'/api/node/update?nodeId=' + node.id" code="update">修改节点</menu-item>
|
||||
</first-menu>
|
||||
|
||||
@@ -32,9 +32,10 @@
|
||||
<h3>方法2:手动安装</h3>
|
||||
<table class="ui table definition selectable">
|
||||
<tr>
|
||||
<td>配置文件<em>(configs/api.yaml)</em></td>
|
||||
<td>配置文件<em>(configs/api.yaml)</em><br/>
|
||||
<em><download-link :v-element="'rpc-code'" :v-file="'api.yaml'">[下载]</download-link ></em></td>
|
||||
<td>
|
||||
<pre>rpc:
|
||||
<pre id="rpc-code">rpc:
|
||||
endpoints: [ {{apiEndpoints}} ]
|
||||
nodeId: "{{node.uniqueId}}"
|
||||
secret: "{{node.secret}}"</pre>
|
||||
|
||||
Reference in New Issue
Block a user