package main
import (
    "fmt"
    "net/http"
    "os
    // "github.com/iotames/miniutils"
    "github.com/iotames/glayui/web"
)
func main() {
    s := web.NewEasyServer(":80")
    s.AddHandler("GET", "/", func(ctx web.Context) {
        urlquery := ctx.Request.URL.Query().Encode()
        newurl := fmt.Sprintf("http://%s/?%s", os.Args[1], urlquery)
        http.Redirect(ctx.Writer, ctx.Request, newurl, http.StatusFound)
        fmt.Printf("-------query(%s)-----newurl(%s)---------\n", urlquery, newurl)
    })
    s.ListenAndServe()
}
Go语言做域名跳转的中间服务器简单示例
未经允许不得转载:沙滩星空的博客 » Go语言做域名跳转的中间服务器简单示例
	
	
	
		
			
		
						 沙滩星空的博客
沙滩星空的博客