Selaa lähdekoodia

auto update script executed

Toby Chui 1 vuosi sitten
vanhempi
commit
8c9ea3da36
4 muutettua tiedostoa jossa 18 lisäystä ja 10 poistoa
  1. 1 1
      Makefile
  2. 1 1
      main.go
  3. 2 0
      mod/dynamicproxy/dpcore/dpcore.go
  4. 14 8
      mod/ganserv/ganserv.go

+ 1 - 1
Makefile

@@ -24,7 +24,7 @@ $(PLATFORMS):
 
 fixwindows:
 	-mv ./dist/zoraxy_windows_amd64 ./dist/zoraxy_windows_amd64.exe
-	-mv ./dist/zoraxy_windows_arm64 ./dist/zoraxy_windows_arm64.exe
+#	-mv ./dist/zoraxy_windows_arm64 ./dist/zoraxy_windows_arm64.exe
 
 
 clear_old:

+ 1 - 1
main.go

@@ -37,7 +37,7 @@ var (
 	name        = "Zoraxy"
 	version     = "2.2"
 	nodeUUID    = "generic"
-	development = true //Set this to false to use embedded web fs
+	development = false //Set this to false to use embedded web fs
 
 	/*
 		Binary Embedding File System

+ 2 - 0
mod/dynamicproxy/dpcore/dpcore.go

@@ -300,6 +300,8 @@ func (p *ReverseProxy) ProxyHTTP(rw http.ResponseWriter, req *http.Request, rrr
 	//Custom header rewriter functions
 	if res.Header.Get("Location") != "" {
 		locationRewrite := res.Header.Get("Location")
+		originLocation := res.Header.Get("Location")
+		res.Header.Set("zr-origin-location", originLocation)
 
 		domainWithoutPort := rrr.ProxyDomain
 		if strings.Contains(rrr.ProxyDomain, ":") {

+ 14 - 8
mod/ganserv/ganserv.go

@@ -70,22 +70,28 @@ type NetworkManager struct {
 	networksMetadata map[string]NetworkMetaData
 }
 
-//Create a new GAN manager
+// Create a new GAN manager
 func NewNetworkManager(option *NetworkManagerOptions) *NetworkManager {
 	option.Database.NewTable("ganserv")
 
+	//Load network metadata
+	networkMeta := map[string]NetworkMetaData{}
+	if option.Database.KeyExists("ganserv", "networkmeta") {
+		option.Database.Read("ganserv", "networkmeta", &networkMeta)
+	}
+
 	//Start the zerotier instance if not exists
 
 	//Get controller info
 	instanceInfo, err := getControllerInfo(option.AuthToken, option.ApiPort)
 	if err != nil {
-		panic(err)
-	}
-
-	//Load network metadata
-	networkMeta := map[string]NetworkMetaData{}
-	if option.Database.KeyExists("ganserv", "networkmeta") {
-		option.Database.Read("ganserv", "networkmeta", &networkMeta)
+		return &NetworkManager{
+			authToken:        option.AuthToken,
+			apiPort:          option.ApiPort,
+			ControllerID:     "",
+			option:           option,
+			networksMetadata: networkMeta,
+		}
 	}
 
 	return &NetworkManager{