Merge branch 'mikesir87-128-replace-underscores-in-urls'

This commit is contained in:
Marcos Lilljedahl
2017-05-12 16:26:03 -03:00
5 changed files with 8 additions and 8 deletions

View File

@@ -11,7 +11,7 @@ import (
"github.com/play-with-docker/play-with-docker/services"
)
var dnsFilter = regexp.MustCompile(`^.*pwd([0-9]{1,3}_[0-9]{1,3}_[0-9]{1,3}_[0-9]{1,3}(?:-[0-9]{1,5})?)\..*$`)
var dnsFilter = regexp.MustCompile(`^.*pwd([0-9]{1,3}-[0-9]{1,3}-[0-9]{1,3}-[0-9]{1,3}(?:-[0-9]{1,5})?)\..*$`)
var aliasFilter = regexp.MustCompile(`^.*pwd(.*?)-(.*?)[\.-].*`)
func DnsRequest(w dns.ResponseWriter, r *dns.Msg) {
@@ -22,7 +22,7 @@ func DnsRequest(w dns.ResponseWriter, r *dns.Msg) {
match := dnsFilter.FindStringSubmatch(question)
tldChunks := strings.Split(match[1], "-")
ip := strings.Replace(tldChunks[0], "_", ".", -1)
ip := strings.Replace(tldChunks[0], "-", ".", -1)
m := new(dns.Msg)
m.SetReply(r)

View File

@@ -38,7 +38,7 @@ func getTargetInfo(vars map[string]string, req *http.Request) (string, string) {
if strings.HasPrefix(node, "pwd") {
// Node is actually an ip, need to convert underscores by dots.
ip := strings.Replace(strings.TrimPrefix(node, "pwd"), "_", ".", -1)
ip := strings.Replace(strings.TrimPrefix(node, "pwd"), "-", ".", -1)
if net.ParseIP(ip) == nil {
// Not a valid IP, so treat this is a hostname.
@@ -143,7 +143,7 @@ func NewSSLDaemonHandler() http.Handler {
node := v["node"]
if strings.HasPrefix(node, "pwd") {
// Node is actually an ip, need to convert underscores by dots.
ip := strings.Replace(strings.TrimPrefix(node, "pwd"), "_", ".", -1)
ip := strings.Replace(strings.TrimPrefix(node, "pwd"), "-", ".", -1)
if net.ParseIP(ip) == nil {
// Not a valid IP, so treat this is a hostname.

View File

@@ -13,7 +13,7 @@ import (
)
func StartTLSProxy(port string) {
var validProxyHost = regexp.MustCompile(`^.*pwd([0-9]{1,3}_[0-9]{1,3}_[0-9]{1,3}_[0-9]{1,3}(?:-[0-9]{1,5})?)\..*$`)
var validProxyHost = regexp.MustCompile(`^.*pwd([0-9]{1,3}-[0-9]{1,3}-[0-9]{1,3}-[0-9]{1,3}(?:-[0-9]{1,5})?)\..*$`)
tlsListener, tlsErr := net.Listen("tcp", fmt.Sprintf(":%s", port))
log.Println("Listening on port " + port)