🎨 优化网络配置,添加子网定义以支持固定IP分配,并更新微信状态显示
All checks were successful
BuildImage / build-image (push) Successful in 4m40s
All checks were successful
BuildImage / build-image (push) Successful in 4m40s
This commit is contained in:
parent
c409dc5a02
commit
37b766368f
@ -77,4 +77,9 @@ volumes:
|
|||||||
|
|
||||||
networks:
|
networks:
|
||||||
wechat-network:
|
wechat-network:
|
||||||
|
name: wechat-network
|
||||||
driver: bridge
|
driver: bridge
|
||||||
|
ipam:
|
||||||
|
driver: default
|
||||||
|
config:
|
||||||
|
- subnet: 172.20.0.0/16 # 定义子网,允许固定IP分配
|
||||||
|
@ -158,15 +158,15 @@ func getNextAvailableIPInNetwork(ctx context.Context, cli *client.Client, networ
|
|||||||
return "", fmt.Errorf("无法检查网络: %w", err)
|
return "", fmt.Errorf("无法检查网络: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 确认网络类型是否为用户自定义网络,并获取子网信息
|
// 确认网络是否有配置子网
|
||||||
if networkResource.IPAM.Config == nil || len(networkResource.IPAM.Config) == 0 {
|
if len(networkResource.IPAM.Config) == 0 {
|
||||||
return "", fmt.Errorf("网络没有IPAM配置")
|
return "", fmt.Errorf("网络没有IPAM配置")
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取网络子网
|
// 获取网络子网
|
||||||
subnet := networkResource.IPAM.Config[0].Subnet
|
subnet := networkResource.IPAM.Config[0].Subnet
|
||||||
if subnet == "" {
|
if subnet == "" {
|
||||||
return "", fmt.Errorf("网络子网未定义")
|
return "", fmt.Errorf("网络子网未定义,不能分配固定IP")
|
||||||
}
|
}
|
||||||
|
|
||||||
// 解析子网
|
// 解析子网
|
||||||
|
@ -110,7 +110,7 @@
|
|||||||
|
|
||||||
<!-- 操作区域 -->
|
<!-- 操作区域 -->
|
||||||
<div class="bg-gray-50 px-6 py-3 flex justify-between items-center">
|
<div class="bg-gray-50 px-6 py-3 flex justify-between items-center">
|
||||||
<span class="text-xs text-gray-500">{{if eq .Status "online"}}运行中{{else}}已停止{{end}}</span>
|
<span class="text-xs text-gray-500">微信状态: {{if eq .Status "online"}}在线{{else}}离线{{end}}</span>
|
||||||
<div class="flex space-x-2">
|
<div class="flex space-x-2">
|
||||||
<a href="/admin/robots/{{.ID}}" class="p-1.5 rounded-md text-gray-600 hover:bg-gray-100 hover:text-gray-900" title="查看详情">
|
<a href="/admin/robots/{{.ID}}" class="p-1.5 rounded-md text-gray-600 hover:bg-gray-100 hover:text-gray-900" title="查看详情">
|
||||||
<i class="fas fa-eye"></i>
|
<i class="fas fa-eye"></i>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user