|
|
@ -5,12 +5,16 @@ import ( |
|
|
"aufs/core" |
|
|
"aufs/core" |
|
|
"fmt" |
|
|
"fmt" |
|
|
"log" |
|
|
"log" |
|
|
|
|
|
"mime" |
|
|
"net/http" |
|
|
"net/http" |
|
|
"os" |
|
|
"os" |
|
|
) |
|
|
) |
|
|
|
|
|
|
|
|
// 启动web服务
|
|
|
// 启动web服务
|
|
|
func startWeb() { |
|
|
func startWeb() { |
|
|
|
|
|
// 手动注册SVG的MIME类型(防止系统默认配置缺失)
|
|
|
|
|
|
mime.AddExtensionType(".svg", "image/svg+xml") |
|
|
|
|
|
mime.AddExtensionType(".svgz", "image/svg+xml") // 压缩的SVG
|
|
|
//创建一个文件服务器,会去www目录下找index.html
|
|
|
//创建一个文件服务器,会去www目录下找index.html
|
|
|
fileServer := http.FileServer(http.Dir("./www")) |
|
|
fileServer := http.FileServer(http.Dir("./www")) |
|
|
// 将 "/" 路径映射到文件服务器
|
|
|
// 将 "/" 路径映射到文件服务器
|
|
|
@ -61,6 +65,7 @@ func main() { |
|
|
if args == nil || len(args) < 2 { |
|
|
if args == nil || len(args) < 2 { |
|
|
// 编程客户端
|
|
|
// 编程客户端
|
|
|
fmt.Printf("run as client\n") |
|
|
fmt.Printf("run as client\n") |
|
|
|
|
|
// 启动web
|
|
|
startWeb() |
|
|
startWeb() |
|
|
// 提示
|
|
|
// 提示
|
|
|
os.Exit(1) |
|
|
os.Exit(1) |
|
|
|