赞
踩
WFS(Web File Server) 是一个可以通过浏览器浏览本地托管目录的在线文件服务器。
使用自定义的 ResponseBodyWriter 结构在 Write 函数中重写 http.ResponseWriter
响应内容。
运行程序,访问 http://127.0.0.1:8080/
即可访问 exe 根目录内容。
package main import ( "bytes" "log" "net/http" "os" "path/filepath" ) func codeStarts() string { return `<!DOCTYPE html> <html> <head> <title>Title</title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <!-- UIkit CSS --> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/uikit@3.10
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。