1 Star 9 Fork 7

gavin56/ddns-go

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
main.go 794 Bytes
一键复制 编辑 原始数据 按行查看 历史
package main
import (
"ddns-go/dns"
"ddns-go/static"
"ddns-go/util"
"ddns-go/web"
"log"
"net/http"
"time"
)
const port = "9876"
func main() {
// 启动静态文件服务
http.Handle("/static/", http.StripPrefix("/static/", http.FileServer(static.AssetFile())))
http.Handle("/favicon.ico", http.StripPrefix("/", http.FileServer(static.AssetFile())))
http.HandleFunc("/", web.Writing)
http.HandleFunc("/save", web.Save)
http.HandleFunc("/logs", web.Logs)
// 打开浏览器
go util.OpenExplorer("http://127.0.0.1:" + port)
log.Println("启动端口", port, "...")
// 定时运行
go dns.RunTimer()
err := http.ListenAndServe(":"+port, nil)
if err != nil {
log.Println("启动端口发生异常, 1分钟后自动关闭此窗口", err)
time.Sleep(time.Minute)
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/gavin56/ddns-go.git
git@gitee.com:gavin56/ddns-go.git
gavin56
ddns-go
ddns-go
master

搜索帮助