base64.stdEncoding (标准加密)
base64.URLEncoding(URL 加密)
Demo : 替换一个经过URL 加密的URL
const PRESIGN_URL = "http://www.jack.com:9200"
func getpresign(url string) (result string) {
m := strings.SplitAfter(url, "/")
s := m[4:]
var num string
for _, v := range s {
num = num + v
}
n, _ := base64.URLEncoding.DecodeString(num)
result = string(n)
return PRESIGN_URL + result
}
func main() {
var str = "https://www.baidu.com/s/L2xiNTkuNjBfdXNlcjAxX2J1Y2tldDAxL016RXhNams1T1RBeE9URXdNakl3T0RBd01EQXdNRGczP0FXU0FjY2Vzc0tleUlkPWxiNTkuNjBfdXNlcjAxJkV4cGlyZXM9MTYzMjY2MTYwMCZTaWduYXR1cmU9QXFIRCUyRlQzUWVNYyUyQlNFZ3lYVXpHcUhlNXZ3dyUzRA==/rIa18v0ymr4vVj5rH5pOa99K"
result := getpresign(str)
fmt.Println(result)
}