ci: add subdomain test case

This commit is contained in:
fatedier
2018-01-22 14:16:46 +08:00
parent a77c7e8625
commit 3f64d73ea9
4 changed files with 40 additions and 0 deletions

View File

@@ -3,6 +3,7 @@ package tests
import (
"fmt"
"net/http"
"regexp"
"strings"
)
@@ -12,6 +13,18 @@ func StartHttpServer() {
}
func request(w http.ResponseWriter, r *http.Request) {
match, err := regexp.Match(`.*\.sub\.com`, []byte(r.Host))
if err != nil {
w.WriteHeader(500)
return
}
if match {
w.WriteHeader(200)
w.Write([]byte(r.Host))
return
}
if strings.Contains(r.Host, "127.0.0.1") || strings.Contains(r.Host, "test2.frp.com") ||
strings.Contains(r.Host, "test5.frp.com") {
w.WriteHeader(200)