mirror of
https://github.com/bingohuang/docker-labs.git
synced 2025-10-04 17:33:21 +08:00
Add DNS support for PWD instances (#94)
* Add DNS support for PWD instances * Store IP address of PWD in all session networks and restore it with the same IP address * Remove unnecesary print * Change url format to pwd<ip>-port for better DNS filtering * Make PWD listen on 80 and 443 for DNS resolve to work
This commit is contained in:
committed by
GitHub
parent
9c4df837a8
commit
f816be6f69
@@ -40,9 +40,9 @@ func NewMultipleHostReverseProxy() *httputil.ReverseProxy {
|
||||
port = "80"
|
||||
}
|
||||
|
||||
if strings.HasPrefix(node, "ip") {
|
||||
if strings.HasPrefix(node, "pwd") {
|
||||
// Node is actually an ip, need to convert underscores by dots.
|
||||
ip := strings.Replace(strings.TrimPrefix(node, "ip"), "_", ".", -1)
|
||||
ip := strings.Replace(strings.TrimPrefix(node, "pwd"), "_", ".", -1)
|
||||
|
||||
if net.ParseIP(ip) == nil {
|
||||
// Not a valid IP, so treat this is a hostname.
|
||||
@@ -69,9 +69,9 @@ func NewSSLDaemonHandler() *httputil.ReverseProxy {
|
||||
director := func(req *http.Request) {
|
||||
v := mux.Vars(req)
|
||||
node := v["node"]
|
||||
if strings.HasPrefix(node, "ip") {
|
||||
if strings.HasPrefix(node, "pwd") {
|
||||
// Node is actually an ip, need to convert underscores by dots.
|
||||
ip := strings.Replace(strings.TrimPrefix(node, "ip"), "_", ".", -1)
|
||||
ip := strings.Replace(strings.TrimPrefix(node, "pwd"), "_", ".", -1)
|
||||
|
||||
if net.ParseIP(ip) == nil {
|
||||
// Not a valid IP, so treat this is a hostname.
|
||||
|
@@ -29,9 +29,9 @@ func NewMultipleHostWebsocketReverseProxy() *wsutil.ReverseProxy {
|
||||
port = "80"
|
||||
}
|
||||
|
||||
if strings.HasPrefix(node, "ip") {
|
||||
if strings.HasPrefix(node, "pwd") {
|
||||
// Node is actually an ip, need to convert underscores by dots.
|
||||
ip := strings.Replace(strings.TrimPrefix(node, "ip"), "_", ".", -1)
|
||||
ip := strings.Replace(strings.TrimPrefix(node, "pwd"), "_", ".", -1)
|
||||
|
||||
if net.ParseIP(ip) == nil {
|
||||
// Not a valid IP, so treat this is a hostname.
|
||||
|
Reference in New Issue
Block a user