Compare commits

...

7 Commits

Author SHA1 Message Date
刘祥超
fd2ae5d445 修改Docker文件版本号为1.3.7 2024-04-29 23:15:24 +08:00
刘祥超
d51370d443 版本修改为1.3.7 2024-04-29 23:12:21 +08:00
刘祥超
2d711408c6 管理平台界面设置中增加“使用的DNS解析库”选项 2024-04-29 15:07:09 +08:00
刘祥超
e911039e33 更新依赖库 2024-04-29 14:24:40 +08:00
刘祥超
e915deffb3 安装MySQL过程中测试MySQL是否能够连接后关闭连接 2024-04-28 11:41:07 +08:00
刘祥超
3b61871399 完善添加/修改源站时“回源主机名”的提示文字 2024-04-25 10:24:20 +08:00
刘祥超
cb33d58685 Docker版本号修改为1.3.6 2024-04-22 11:17:20 +08:00
12 changed files with 65 additions and 14 deletions

View File

@@ -1,7 +1,7 @@
FROM --platform=linux/amd64 alpine:latest FROM --platform=linux/amd64 alpine:latest
LABEL maintainer="goedge.cdn@gmail.com" LABEL maintainer="goedge.cdn@gmail.com"
ENV TZ "Asia/Shanghai" ENV TZ "Asia/Shanghai"
ENV VERSION 1.3.5 ENV VERSION 1.3.7
ENV ROOT_DIR /usr/local/goedge ENV ROOT_DIR /usr/local/goedge
ENV TAR_FILE edge-admin-linux-amd64-plus-v${VERSION}.zip ENV TAR_FILE edge-admin-linux-amd64-plus-v${VERSION}.zip

2
go.mod
View File

@@ -8,7 +8,7 @@ require (
github.com/TeaOSLab/EdgeCommon v0.0.0-00010101000000-000000000000 github.com/TeaOSLab/EdgeCommon v0.0.0-00010101000000-000000000000
github.com/cespare/xxhash/v2 v2.2.0 github.com/cespare/xxhash/v2 v2.2.0
github.com/go-sql-driver/mysql v1.5.0 github.com/go-sql-driver/mysql v1.5.0
github.com/iwind/TeaGo v0.0.0-20240312020455-6f20b5121caf github.com/iwind/TeaGo v0.0.0-20240429060313-31a7bc8e9cc9
github.com/iwind/gosock v0.0.0-20211103081026-ee4652210ca4 github.com/iwind/gosock v0.0.0-20211103081026-ee4652210ca4
github.com/miekg/dns v1.1.43 github.com/miekg/dns v1.1.43
github.com/quic-go/quic-go v0.42.0 github.com/quic-go/quic-go v0.42.0

2
go.sum
View File

@@ -30,6 +30,8 @@ github.com/google/pprof v0.0.0-20240402174815-29b9bb013b0f h1:f00RU+zOX+B3rLAmMM
github.com/google/pprof v0.0.0-20240402174815-29b9bb013b0f/go.mod h1:kf6iHlnVGwgKolg33glAes7Yg/8iWP8ukqeldJSO7jw= github.com/google/pprof v0.0.0-20240402174815-29b9bb013b0f/go.mod h1:kf6iHlnVGwgKolg33glAes7Yg/8iWP8ukqeldJSO7jw=
github.com/iwind/TeaGo v0.0.0-20240312020455-6f20b5121caf h1:WA9qgiynESu/DDTnLH6npRI5AK6UL9qwJ2YZ5qhJX5E= github.com/iwind/TeaGo v0.0.0-20240312020455-6f20b5121caf h1:WA9qgiynESu/DDTnLH6npRI5AK6UL9qwJ2YZ5qhJX5E=
github.com/iwind/TeaGo v0.0.0-20240312020455-6f20b5121caf/go.mod h1:SfqVbWyIPdVflyA6lMgicZzsoGS8pyeLiTRe8/CIpGI= github.com/iwind/TeaGo v0.0.0-20240312020455-6f20b5121caf/go.mod h1:SfqVbWyIPdVflyA6lMgicZzsoGS8pyeLiTRe8/CIpGI=
github.com/iwind/TeaGo v0.0.0-20240429060313-31a7bc8e9cc9 h1:lqSd+OeAMzPlejoVtsmHJEeQ6/MWXCr+Ws2eX9/Rewg=
github.com/iwind/TeaGo v0.0.0-20240429060313-31a7bc8e9cc9/go.mod h1:SfqVbWyIPdVflyA6lMgicZzsoGS8pyeLiTRe8/CIpGI=
github.com/iwind/gosock v0.0.0-20211103081026-ee4652210ca4 h1:VWGsCqTzObdlbf7UUE3oceIpcEKi4C/YBUszQXk118A= github.com/iwind/gosock v0.0.0-20211103081026-ee4652210ca4 h1:VWGsCqTzObdlbf7UUE3oceIpcEKi4C/YBUszQXk118A=
github.com/iwind/gosock v0.0.0-20211103081026-ee4652210ca4/go.mod h1:H5Q7SXwbx3a97ecJkaS2sD77gspzE7HFUafBO0peEyA= github.com/iwind/gosock v0.0.0-20211103081026-ee4652210ca4/go.mod h1:H5Q7SXwbx3a97ecJkaS2sD77gspzE7HFUafBO0peEyA=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=

View File

@@ -93,6 +93,7 @@ func loadAdminUIConfig() (*systemconfigs.AdminUIConfig, error) {
} }
var config = &systemconfigs.AdminUIConfig{} var config = &systemconfigs.AdminUIConfig{}
config.DNSResolver.Type = nodeconfigs.DNSResolverTypeDefault // 默认值
err = json.Unmarshal(resp.ValueJSON, config) err = json.Unmarshal(resp.ValueJSON, config)
if err != nil { if err != nil {
logs.Println("[UI_MANAGER]" + err.Error()) logs.Println("[UI_MANAGER]" + err.Error())
@@ -108,7 +109,7 @@ func loadAdminUIConfig() (*systemconfigs.AdminUIConfig, error) {
} }
func defaultAdminUIConfig() *systemconfigs.AdminUIConfig { func defaultAdminUIConfig() *systemconfigs.AdminUIConfig {
return &systemconfigs.AdminUIConfig{ var config = &systemconfigs.AdminUIConfig{
ProductName: langs.DefaultMessage(codes.AdminUI_DefaultProductName), ProductName: langs.DefaultMessage(codes.AdminUI_DefaultProductName),
AdminSystemName: langs.DefaultMessage(codes.AdminUI_DefaultSystemName), AdminSystemName: langs.DefaultMessage(codes.AdminUI_DefaultSystemName),
ShowOpenSourceInfo: true, ShowOpenSourceInfo: true,
@@ -117,6 +118,8 @@ func defaultAdminUIConfig() *systemconfigs.AdminUIConfig {
DefaultPageSize: 10, DefaultPageSize: 10,
TimeZone: nodeconfigs.DefaultTimeZoneLocation, TimeZone: nodeconfigs.DefaultTimeZoneLocation,
} }
config.DNSResolver.Type = nodeconfigs.DNSResolverTypeDefault
return config
} }
// 修改时区 // 修改时区

View File

@@ -1,9 +1,9 @@
package teaconst package teaconst
const ( const (
Version = "1.3.6" Version = "1.3.7"
APINodeVersion = "1.3.6" APINodeVersion = "1.3.7"
ProductName = "Edge Admin" ProductName = "Edge Admin"
ProcessName = "edge-admin" ProcessName = "edge-admin"

View File

@@ -8,6 +8,7 @@ import (
teaconst "github.com/TeaOSLab/EdgeAdmin/internal/const" teaconst "github.com/TeaOSLab/EdgeAdmin/internal/const"
"github.com/TeaOSLab/EdgeAdmin/internal/events" "github.com/TeaOSLab/EdgeAdmin/internal/events"
"github.com/TeaOSLab/EdgeAdmin/internal/utils" "github.com/TeaOSLab/EdgeAdmin/internal/utils"
"github.com/TeaOSLab/EdgeCommon/pkg/nodeconfigs"
"github.com/iwind/TeaGo" "github.com/iwind/TeaGo"
"github.com/iwind/TeaGo/Tea" "github.com/iwind/TeaGo/Tea"
"github.com/iwind/TeaGo/lists" "github.com/iwind/TeaGo/lists"
@@ -87,6 +88,9 @@ func (this *AdminNode) Run() {
// 启动API节点 // 启动API节点
this.startAPINode() this.startAPINode()
// 设置DNS相关
this.setupDNS()
// 启动IP库 // 启动IP库
this.startIPLibrary() this.startIPLibrary()
@@ -254,6 +258,33 @@ func (this *AdminNode) addPortsToFirewall() {
utils.AddPortsToFirewall(ports) utils.AddPortsToFirewall(ports)
} }
// 设置DNS相关
func (this *AdminNode) setupDNS() {
config, loadErr := configloaders.LoadAdminUIConfig()
if loadErr != nil {
// 默认使用go原生
err := os.Setenv("GODEBUG", "netdns=go")
if err != nil {
logs.Println("[DNS_RESOLVER]set env failed: " + err.Error())
}
return
}
var err error
switch config.DNSResolver.Type {
case nodeconfigs.DNSResolverTypeGoNative:
err = os.Setenv("GODEBUG", "netdns=go")
case nodeconfigs.DNSResolverTypeCGO:
err = os.Setenv("GODEBUG", "netdns=cgo")
default:
// 默认使用go原生
err = os.Setenv("GODEBUG", "netdns=go")
}
if err != nil {
logs.Println("[DNS_RESOLVER]set env failed: " + err.Error())
}
}
// 启动API节点 // 启动API节点
func (this *AdminNode) startAPINode() { func (this *AdminNode) startAPINode() {
var configPath = Tea.Root + "/edge-api/configs/api.yaml" var configPath = Tea.Root + "/edge-api/configs/api.yaml"

View File

@@ -55,6 +55,7 @@ func (this *IndexAction) RunPost(params struct {
LogoFile *actions.File LogoFile *actions.File
DefaultPageSize int DefaultPageSize int
TimeZone string TimeZone string
DnsResolverType string
SupportModuleCDN bool SupportModuleCDN bool
SupportModuleNS bool SupportModuleNS bool
@@ -85,6 +86,7 @@ func (this *IndexAction) RunPost(params struct {
config.ShowVersion = params.ShowVersion config.ShowVersion = params.ShowVersion
config.Version = params.Version config.Version = params.Version
config.TimeZone = params.TimeZone config.TimeZone = params.TimeZone
config.DNSResolver.Type = params.DnsResolverType
if params.DefaultPageSize > 0 { if params.DefaultPageSize > 0 {
config.DefaultPageSize = params.DefaultPageSize config.DefaultPageSize = params.DefaultPageSize
@@ -111,10 +113,10 @@ func (this *IndexAction) RunPost(params struct {
this.ErrorPage(err) this.ErrorPage(err)
return return
} }
fileId := createResp.FileId var fileId = createResp.FileId
// 上传内容 // 上传内容
buf := make([]byte, 512*1024) var buf = make([]byte, 512*1024)
reader, err := params.FaviconFile.OriginFile.Open() reader, err := params.FaviconFile.OriginFile.Open()
if err != nil { if err != nil {
this.ErrorPage(err) this.ErrorPage(err)
@@ -158,10 +160,10 @@ func (this *IndexAction) RunPost(params struct {
this.ErrorPage(err) this.ErrorPage(err)
return return
} }
fileId := createResp.FileId var fileId = createResp.FileId
// 上传内容 // 上传内容
buf := make([]byte, 512*1024) var buf = make([]byte, 512*1024)
reader, err := params.LogoFile.OriginFile.Open() reader, err := params.LogoFile.OriginFile.Open()
if err != nil { if err != nil {
this.ErrorPage(err) this.ErrorPage(err)

View File

@@ -344,10 +344,12 @@ func (this *MySQLInstaller) InstallFromFile(xzFilePath string, targetDir string)
// waiting for startup // waiting for startup
for i := 0; i < 30; i++ { for i := 0; i < 30; i++ {
_, err = net.Dial("tcp", "127.0.0.1:3306") var conn net.Conn
conn, err = net.Dial("tcp", "127.0.0.1:3306")
if err != nil { if err != nil {
time.Sleep(1 * time.Second) time.Sleep(1 * time.Second)
} else { } else {
_ = conn.Close()
break break
} }
} }

View File

@@ -46,7 +46,7 @@
<td>回源主机名</td> <td>回源主机名</td>
<td> <td>
<input type="text" name="host" placeholder="比如example.com" maxlength="100"/> <input type="text" name="host" placeholder="比如example.com" maxlength="100"/>
<p class="comment">可选项。请求源站时的Host字段值用于设置访问源站的站点域名<span v-if="isHTTP">,支持请求变量</span></p> <p class="comment">可选项。请求源站时的Host字段值用于设置访问源站的站点域名<span v-if="isHTTP">,支持请求变量</span>;如果用户访问的域名和源站域名不一致,请务必设置为源站域名</p>
</td> </td>
</tr> </tr>

View File

@@ -48,7 +48,7 @@
<td>回源主机名</td> <td>回源主机名</td>
<td> <td>
<input type="text" name="host" placeholder="比如example.com" maxlength="100"/> <input type="text" name="host" placeholder="比如example.com" maxlength="100"/>
<p class="comment">可选项。请求源站时的Host字段值用于设置访问源站的站点域名<span v-if="isHTTP">,支持请求变量</span></p> <p class="comment">可选项。请求源站时的Host字段值用于设置访问源站的站点域名<span v-if="isHTTP">,支持请求变量</span>;如果用户访问的域名和源站域名不一致,请务必设置为源站域名</p>
</td> </td>
</tr> </tr>

View File

@@ -49,7 +49,7 @@
<td>回源主机名</td> <td>回源主机名</td>
<td> <td>
<input type="text" name="host" v-model="origin.host" placeholder="比如example.com" maxlength="100"/> <input type="text" name="host" v-model="origin.host" placeholder="比如example.com" maxlength="100"/>
<p class="comment">可选项。请求源站时的Host字段值用于设置访问源站的站点域名<span v-if="isHTTP">,支持请求变量</span></p> <p class="comment">可选项。请求源站时的Host字段值用于设置访问源站的站点域名<span v-if="isHTTP">,支持请求变量</span>;如果用户访问的域名和源站域名不一致,请务必设置为源站域名</p>
</td> </td>
</tr> </tr>

View File

@@ -109,7 +109,18 @@
</select> </select>
</div> </div>
</div> </div>
<p class="comment">显示时间使用的时区。</p> <p class="comment">当前管理系统显示时间使用的时区。</p>
</td>
</tr>
<tr>
<td>使用的DNS解析库</td>
<td>
<select class="ui dropdown auto-width" name="dnsResolverType" v-model="config.dnsResolver.type">
<option value="default">默认</option>
<option value="cgo">CGO</option>
<option value="goNative">Go原生</option>
</select>
<p class="comment">当前管理系统使用的DNS解析库修改此项配置后需要重启管理系统进程才会生效通常不需要修改如要修改请在专家指导下进行。</p>
</td> </td>
</tr> </tr>
</table> </table>