From 505ef3b98285d3275f9b59f16c6eaaa9c454a572 Mon Sep 17 00:00:00 2001 From: Akilan Date: Thu, 22 Aug 2024 17:14:13 +0100 Subject: [PATCH 01/18] added base reverse proxy --- Bindings/Client.go | 4 +- abstractions/base.go | 4 +- client/MAPPort.go | 4 +- cmd/action.go | 2 +- cmd/flags.go | 8 +++ config/config.go | 1 + config/generate/generate.go | 1 + p2p/iptable.go | 1 + p2p/upnp_test.go | 14 ++-- plugin/TestAnsible/site.yml | 2 +- server/ReverseProxy.go | 135 ++++++++++++++++++++++++++++++++++++ server/server.go | 63 ++++++++++++++++- 12 files changed, 221 insertions(+), 18 deletions(-) create mode 100644 server/ReverseProxy.go diff --git a/Bindings/Client.go b/Bindings/Client.go index 5c6fea2..0d3c66d 100644 --- a/Bindings/Client.go +++ b/Bindings/Client.go @@ -134,8 +134,8 @@ func EscapeFirewall(HostOutsideNATIP string, HostOutsideNATPort string, internal } //export MapPort -func MapPort(Port string) *C.char { - entireAddress, _, err := abstractions.MapPort(Port) +func MapPort(Port string, DomainName string) *C.char { + entireAddress, _, err := abstractions.MapPort(Port, DomainName) if err != nil { return C.CString(err.Error()) } diff --git a/abstractions/base.go b/abstractions/base.go index 0e9ff15..56e02d7 100644 --- a/abstractions/base.go +++ b/abstractions/base.go @@ -52,8 +52,8 @@ func Start() (*gin.Engine, error) { } // MapPort Creates a reverse proxy connection and maps the appropriate port -func MapPort(port string) (entireAddres string, mapPort string, err error) { - entireAddres, mapPort, err = server.MapPort(port) +func MapPort(port string, domainName string) (entireAddres string, mapPort string, err error) { + entireAddres, mapPort, err = server.MapPort(port, domainName) return } diff --git a/client/MAPPort.go b/client/MAPPort.go index 851a213..71f3727 100644 --- a/client/MAPPort.go +++ b/client/MAPPort.go @@ -6,14 +6,14 @@ import ( "net/http" ) -func MAPPort(port string) (string, error) { +func MAPPort(port string, domainName string) (string, error) { Config, err := config.ConfigInit(nil, nil) if err != nil { return "", err } //if version == "version 6" { - URL := "http://0.0.0.0:" + Config.ServerPort + "/MAPPort?port=" + port + URL := "http://0.0.0.0:" + Config.ServerPort + "/MAPPort?port=" + port + "&domain_name=" + domainName //} else { // URL = "http://" + IP + ":" + serverPort + "/server_info" //} diff --git a/cmd/action.go b/cmd/action.go index 9f118d7..4014cc9 100644 --- a/cmd/action.go +++ b/cmd/action.go @@ -283,7 +283,7 @@ var CliAction = func(ctx *cli.Context) error { } if MAPPort != "" { - address, err := client.MAPPort(MAPPort) + address, err := client.MAPPort(MAPPort, DomainName) if err != nil { return err } diff --git a/cmd/flags.go b/cmd/flags.go index 1403e96..04b3996 100644 --- a/cmd/flags.go +++ b/cmd/flags.go @@ -30,6 +30,7 @@ var ( RemoveContainerGroup bool RemoveGroup string MAPPort string + DomainName string //FRPProxy bool // Generate only allowed in dev release // -- REMOVE ON REGULAR RELEASE -- @@ -212,6 +213,13 @@ var AppConfigFlags = []cli.Flag{ EnvVars: []string{"MAPPORT"}, Destination: &MAPPort, }, + &cli.StringFlag{ + Name: "DomainName", + Aliases: []string{"dn"}, + Usage: "While mapping ports allows to set a domain name to create a mapping in the proxy server", + EnvVars: []string{"DOMAINNAME"}, + Destination: &DomainName, + }, // Generate only allowed in dev release // -- REMOVE ON REGULAR RELEASE -- &cli.StringFlag{ diff --git a/config/config.go b/config/config.go index 62572c5..947e4e7 100644 --- a/config/config.go +++ b/config/config.go @@ -27,6 +27,7 @@ type Config struct { PluginPath string TrackContainersPath string ServerPort string + ProxyPort string GroupTrackContainersPath string FRPServerPort string BehindNAT string diff --git a/config/generate/generate.go b/config/generate/generate.go index 695021f..26b07ac 100644 --- a/config/generate/generate.go +++ b/config/generate/generate.go @@ -77,6 +77,7 @@ func SetDefaults(envName string, forceDefault bool, CustomConfig interface{}, No Defaults.TrackContainersPath = defaultPath + "client/trackcontainers/trackcontainers.json" Defaults.GroupTrackContainersPath = defaultPath + "client/trackcontainers/grouptrackcontainers.json" Defaults.ServerPort = "8088" + Defaults.ProxyPort = "" Defaults.FRPServerPort = "True" Defaults.CustomConfig = CustomConfig Defaults.BehindNAT = "True" diff --git a/p2p/iptable.go b/p2p/iptable.go index 0f67d42..372d88d 100644 --- a/p2p/iptable.go +++ b/p2p/iptable.go @@ -30,6 +30,7 @@ type IpAddress struct { BareMetalSSHPort string `json:"BareMetalSSHPort"` NAT string `json:"NAT"` EscapeImplementation string `json:"EscapeImplementation"` + ProxyServer string `json:"ProxyServer"` CustomInformation string `json:"CustomInformation"` //CustomInformationKey []byte `json:"CustomInformationKey"` } diff --git a/p2p/upnp_test.go b/p2p/upnp_test.go index ef53493..6ac79cd 100644 --- a/p2p/upnp_test.go +++ b/p2p/upnp_test.go @@ -1,15 +1,15 @@ package p2p import ( - "fmt" - "testing" + "fmt" + "testing" ) // Tests if the current has UPNP support func TestForwardUPNPPort(t *testing.T) { - err := ForwardPort(6586) - if err != nil { - fmt.Println(err) - t.Fail() - } + err := ForwardPort(6586) + if err != nil { + fmt.Println(err) + t.Fail() + } } diff --git a/plugin/TestAnsible/site.yml b/plugin/TestAnsible/site.yml index 3dc78ac..f263373 100644 --- a/plugin/TestAnsible/site.yml +++ b/plugin/TestAnsible/site.yml @@ -5,4 +5,4 @@ tasks: - name: simple-ansibleplaybook debug: - msg: Your are running 'simple-ansibleplaybook' example \ No newline at end of file + msg: Your are running 'simple-ansibleplaybook' example diff --git a/server/ReverseProxy.go b/server/ReverseProxy.go new file mode 100644 index 0000000..7670c2c --- /dev/null +++ b/server/ReverseProxy.go @@ -0,0 +1,135 @@ +// source:https://github.com/afoley587/go-rev-proxy/tree/main +package server + +import ( + "errors" + "fmt" + "github.com/gin-gonic/gin" + "log" + "net/http" + "net/http/httputil" + "net/url" +) + +var ( + //RunPort = 2002 // The server port to run on + //ReverseServerAddr = fmt.Sprint("0.0.0.0:", RunPort) // this is our reverse server ip address + //InsideProxyHostname = fmt.Sprint("proxy:", RunPort) // Requests from private network + //OutsideProxyHostname = fmt.Sprint("registration.localhost:", RunPort) // Requests from public network + KnownAddresses = map[string]string{} // Known Addresses +) + +type RegistrationRequest struct { + OutsideHost string // Outside host address. The hostname or IP on the public network. For example foo.bar.com or foo.localhost + InsideHost string // Inside host address. The hostname or IP on the internal network. For example 192.168.10.5 +} + +// This function checks if TLS was enabled on the request +// and translates it to the proper scheme (http or https) +func GetScheme(c *gin.Context) string { + if c.Request.TLS != nil { + return "https" + } else { + return "http" + } +} + +// IsRegistrationRequest checks if an incoming request is meant to register +// a new inside/outside hostname pair by checking if the hostname and +// path match a specific combination. +// If the host is our registration.localhost or proxy hostname +// AND if the path is /register, we will register a new endpoint +//func IsRegistrationRequest(c *gin.Context) bool { +// isRR := ((c.Request.Host == InsideProxyHostname || c.Request.Host == OutsideProxyHostname) && +// c.Request.URL.String() == "/register") +// return isRR +//} +// +//// SaveRegistrationRequest saves an inside/outside hostname pairing +//// to our KnownAddresses map so we can use it later. Effectively +//// registering a new endpoint for us +//func SaveRegistrationRequest(c *gin.Context) error { +// var rr RegistrationRequest +// log.Println(c.Request.Body) +// err := c.BindJSON(&rr) +// +// if err != nil { +// return err +// } +// +// log.Println("Registering", rr.OutsideHost, "to", rr.InsideHost) +// KnownAddresses[rr.OutsideHost] = rr.InsideHost +// return nil +//} + +// SaveRegistration Creates registration of proxy node +func SaveRegistration(OutsideHost string, InsideHost string) error { + _, ok := KnownAddresses[OutsideHost] + if !ok { + return errors.New("domain name provided already exists") + } + KnownAddresses[OutsideHost] = InsideHost + + return nil +} + +// Proxy runs the actual proxy and will look at the +// hostnames requested from the received request. It will +// then translate that to the inside hostname and forward the +// request +func Proxy(c *gin.Context) { + + // Get if HTTP or HTTPS + scheme := GetScheme(c) + + log.Println(scheme, c.Request.Host, c.Request.URL.String()) + + // Translate the outside hostname to the inside hostname + forwardTo, ok := KnownAddresses[c.Request.Host] + + if !ok { + log.Printf("Unkown Host: %v", c.Request.Host) + c.String(400, "Unkown Host") + return + } + + rUrl := fmt.Sprintf("%v://%v%v", scheme, forwardTo, c.Request.URL) + + remote, err := url.Parse(rUrl) + + if err != nil { + log.Println(err) + c.String(500, "Error Proxying Host") + return + } + + log.Println("Forwarding request to", remote) + + // Forward the request to the inside remote server + // https://pkg.go.dev/net/http/httputil#NewSingleHostReverseProxy + proxy := httputil.NewSingleHostReverseProxy(remote) + + // Director is a function which modifies + // the request into a new request to be sent + // https://pkg.go.dev/net/http/httputil#ReverseProxy + proxy.Director = func(req *http.Request) { + req.Header = c.Request.Header + req.Host = remote.Host + req.URL.Scheme = remote.Scheme + req.URL.Host = remote.Host + req.URL.Path = c.Param("path") + } + + proxy.ServeHTTP(c.Writer, c.Request) +} + +func ProxyRun(port string) { + r := gin.Default() + + // all paths should be handled by Proxy() + r.Any("/*path", Proxy) + + if err := r.Run(fmt.Sprint("0.0.0.0:", port)); err != nil { + log.Printf("Error: %v", err) + } +} diff --git a/server/server.go b/server/server.go index 43fc27a..6816a9d 100644 --- a/server/server.go +++ b/server/server.go @@ -16,9 +16,24 @@ import ( "time" ) +type ReverseProxy struct { + IPAddress string + Port string +} + +// ReverseProxies Reverse to the map such as ReverseProxies[]ReverseProxy type +var ReverseProxies map[string]ReverseProxy + func Server() (*gin.Engine, error) { r := gin.Default() + // "The make function allocates and initializes a hash map data + //structure and returns a map value that points to it. + //The specifics of that data structure are an implementation + //detail of the runtime and are not specified by the language itself." + // source: https://go.dev/blog/maps + ReverseProxies = make(map[string]ReverseProxy) + //Get Server port based on the config file config, err := config.ConfigInit(nil, nil) if err != nil { @@ -175,7 +190,8 @@ func Server() (*gin.Engine, error) { r.GET("/MAPPort", func(c *gin.Context) { Ports := c.DefaultQuery("port", "0") - url, _, err := MapPort(Ports) + DomainName := c.DefaultQuery("domain_name", "0") + url, _, err := MapPort(Ports, DomainName) if err != nil { c.String(http.StatusInternalServerError, fmt.Sprintf("error: %s", err)) } @@ -183,6 +199,42 @@ func Server() (*gin.Engine, error) { c.String(http.StatusOK, url) }) + r.GET("/AddProxy", func(c *gin.Context) { + DomainName := c.DefaultQuery("domain_name", "") + ip_address := c.DefaultQuery("ip_address", "") + Ports := c.DefaultQuery("port", "") + + if DomainName == "" || ip_address == "" || Ports == "" { + c.String(http.StatusInternalServerError, fmt.Sprintf("All get parameters npt provided"+ + " do ensure domain_name, ip_Address and port no is provided")) + } + + SaveRegistration(DomainName, ip_address+":"+Ports) + + //_, ok := ReverseProxies[DomainName] + //// To check if the subdomain entry exists + //if ok { + // c.String(http.StatusInternalServerError, fmt.Sprintf("The domain entry already exists as a reverse"+ + // " proxy entry")) + //} + // + //// added proxy as a map entry + //ReverseProxies[DomainName] = ReverseProxy{IPAddress: ip_address, Port: Ports} + + }) + + r.GET("/RemoveProxy", func(c *gin.Context) { + DomainName := c.DefaultQuery("domain_name", "") + + _, ok := ReverseProxies[DomainName] + if !ok { + c.String(http.StatusInternalServerError, fmt.Sprintf("Domain name does exist in entries of proxies")) + } else { + delete(ReverseProxies, DomainName) + } + + }) + // If there is a proxy port specified // then starts the FRP server //if config.FRPServerPort != "0" { @@ -233,6 +285,7 @@ func Server() (*gin.Engine, error) { ProxyIpAddr.ServerPort = proxyPort ProxyIpAddr.Name = config.MachineName ProxyIpAddr.NAT = "False" + ProxyIpAddr.ProxyServer = "False" ProxyIpAddr.EscapeImplementation = "FRP" // Sorry Jan it's a string @@ -240,7 +293,7 @@ func Server() (*gin.Engine, error) { // to a boolean operator // But I am way too tired if config.BareMetal == "True" { - _, SSHPort, err := MapPort("22") + _, SSHPort, err := MapPort("22", "") if err != nil { return nil, err } @@ -269,13 +322,17 @@ func Server() (*gin.Engine, error) { } + if config.ProxyPort != "" { + go ProxyRun(config.ProxyPort) + } + // Run gin server on the specified port go r.Run(":" + config.ServerPort) return r, nil } -func MapPort(port string) (string, string, error) { +func MapPort(port string, domainName string) (string, string, error) { //Get Server port based on the config file config, err := config.ConfigInit(nil, nil) if err != nil { From 5d20e688a8875694f1c7e72cb49074b7e4872351 Mon Sep 17 00:00:00 2001 From: Akilan Date: Fri, 23 Aug 2024 01:46:18 +0100 Subject: [PATCH 02/18] added domain name as parameter --- server/server.go | 646 ++++++++++++++++++++++++----------------------- 1 file changed, 330 insertions(+), 316 deletions(-) diff --git a/server/server.go b/server/server.go index 6816a9d..c117812 100644 --- a/server/server.go +++ b/server/server.go @@ -1,390 +1,404 @@ package server import ( - b64 "encoding/base64" - "encoding/json" - "fmt" - "github.com/Akilan1999/p2p-rendering-computation/client/clientIPTable" - "github.com/Akilan1999/p2p-rendering-computation/config" - "github.com/Akilan1999/p2p-rendering-computation/p2p" - "github.com/Akilan1999/p2p-rendering-computation/p2p/frp" - "github.com/Akilan1999/p2p-rendering-computation/server/docker" - "github.com/gin-gonic/gin" - "io/ioutil" - "net/http" - "strconv" - "time" + b64 "encoding/base64" + "encoding/json" + "errors" + "fmt" + "github.com/Akilan1999/p2p-rendering-computation/client/clientIPTable" + "github.com/Akilan1999/p2p-rendering-computation/config" + "github.com/Akilan1999/p2p-rendering-computation/p2p" + "github.com/Akilan1999/p2p-rendering-computation/p2p/frp" + "github.com/Akilan1999/p2p-rendering-computation/server/docker" + "github.com/gin-gonic/gin" + "io/ioutil" + "net/http" + "strconv" + "time" ) type ReverseProxy struct { - IPAddress string - Port string + IPAddress string + Port string } // ReverseProxies Reverse to the map such as ReverseProxies[]ReverseProxy type var ReverseProxies map[string]ReverseProxy func Server() (*gin.Engine, error) { - r := gin.Default() + r := gin.Default() - // "The make function allocates and initializes a hash map data - //structure and returns a map value that points to it. - //The specifics of that data structure are an implementation - //detail of the runtime and are not specified by the language itself." - // source: https://go.dev/blog/maps - ReverseProxies = make(map[string]ReverseProxy) + // "The make function allocates and initializes a hash map data + //structure and returns a map value that points to it. + //The specifics of that data structure are an implementation + //detail of the runtime and are not specified by the language itself." + // source: https://go.dev/blog/maps + ReverseProxies = make(map[string]ReverseProxy) - //Get Server port based on the config file - config, err := config.ConfigInit(nil, nil) - if err != nil { - return nil, err - } + //Get Server port based on the config file + config, err := config.ConfigInit(nil, nil) + if err != nil { + return nil, err + } - // update IPTable with new port and ip address and update ip table - var ProxyIpAddr p2p.IpAddress - var lowestLatencyIpAddress p2p.IpAddress + // update IPTable with new port and ip address and update ip table + var ProxyIpAddr p2p.IpAddress + var lowestLatencyIpAddress p2p.IpAddress - // Gets default information of the server - r.GET("/server_info", func(c *gin.Context) { - c.JSON(http.StatusOK, ServerInfo()) - }) + // Gets default information of the server + r.GET("/server_info", func(c *gin.Context) { + c.JSON(http.StatusOK, ServerInfo()) + }) - // Speed test with 50 mbps - r.GET("/50", func(c *gin.Context) { - // Get Path from config - c.File(config.SpeedTestFile) - }) + // Speed test with 50 mbps + r.GET("/50", func(c *gin.Context) { + // Get Path from config + c.File(config.SpeedTestFile) + }) - // Route build to do a speed test - r.GET("/upload", func(c *gin.Context) { - file, _ := c.FormFile("file") + // Route build to do a speed test + r.GET("/upload", func(c *gin.Context) { + file, _ := c.FormFile("file") - // Upload the file to specific dst. - // c.SaveUploadedFile(file, dst) + // Upload the file to specific dst. + // c.SaveUploadedFile(file, dst) - c.String(http.StatusOK, fmt.Sprintf("'%s' uploaded!", file.Filename)) - }) + c.String(http.StatusOK, fmt.Sprintf("'%s' uploaded!", file.Filename)) + }) - //Gets Ip Table from server node - r.POST("/IpTable", func(c *gin.Context) { - // Getting IPV4 address of client - var ClientHost p2p.IpAddress + //Gets Ip Table from server node + r.POST("/IpTable", func(c *gin.Context) { + // Getting IPV4 address of client + var ClientHost p2p.IpAddress - if p2p.Ip4or6(c.ClientIP()) == "version 6" { - ClientHost.Ipv6 = c.ClientIP() - } else { - ClientHost.Ipv4 = c.ClientIP() - } + if p2p.Ip4or6(c.ClientIP()) == "version 6" { + ClientHost.Ipv6 = c.ClientIP() + } else { + ClientHost.Ipv4 = c.ClientIP() + } - // Variable to store IP table information - var IPTable p2p.IpAddresses + // Variable to store IP table information + var IPTable p2p.IpAddresses - // Receive file from POST request - body, err := c.FormFile("json") - if err != nil { - c.String(http.StatusOK, fmt.Sprint(err)) - } + // Receive file from POST request + body, err := c.FormFile("json") + if err != nil { + c.String(http.StatusOK, fmt.Sprint(err)) + } - // Open file - open, err := body.Open() - if err != nil { - c.String(http.StatusOK, fmt.Sprint(err)) - } + // Open file + open, err := body.Open() + if err != nil { + c.String(http.StatusOK, fmt.Sprint(err)) + } - // Open received file - file, err := ioutil.ReadAll(open) - if err != nil { - c.String(http.StatusOK, fmt.Sprint(err)) - } + // Open received file + file, err := ioutil.ReadAll(open) + if err != nil { + c.String(http.StatusOK, fmt.Sprint(err)) + } - json.Unmarshal(file, &IPTable) + json.Unmarshal(file, &IPTable) - //Add Client IP address to IPTable struct - IPTable.IpAddress = append(IPTable.IpAddress, ClientHost) + //Add Client IP address to IPTable struct + IPTable.IpAddress = append(IPTable.IpAddress, ClientHost) - // Runs speed test to return only servers in the IP table pingable - err = IPTable.SpeedTestUpdatedIPTable() - if err != nil { - c.String(http.StatusOK, fmt.Sprint(err)) - } + // Runs speed test to return only servers in the IP table pingable + err = IPTable.SpeedTestUpdatedIPTable() + if err != nil { + c.String(http.StatusOK, fmt.Sprint(err)) + } - // Reads IP addresses from ip table - IpAddresses, err := p2p.ReadIpTable() - if err != nil { - c.String(http.StatusOK, fmt.Sprint(err)) - } + // Reads IP addresses from ip table + IpAddresses, err := p2p.ReadIpTable() + if err != nil { + c.String(http.StatusOK, fmt.Sprint(err)) + } - c.JSON(http.StatusOK, IpAddresses) - }) + c.JSON(http.StatusOK, IpAddresses) + }) - // Starts docker container in server - r.GET("/startcontainer", func(c *gin.Context) { - // Get Number of ports to open and whether to use GPU or not - Ports := c.DefaultQuery("ports", "0") - GPU := c.DefaultQuery("GPU", "false") - ContainerName := c.DefaultQuery("ContainerName", "") - BaseImage := c.DefaultQuery("BaseImage", "") - PublicKey := c.DefaultQuery("PublicKey", "") - var PortsInt int + // Starts docker container in server + r.GET("/startcontainer", func(c *gin.Context) { + // Get Number of ports to open and whether to use GPU or not + Ports := c.DefaultQuery("ports", "0") + GPU := c.DefaultQuery("GPU", "false") + ContainerName := c.DefaultQuery("ContainerName", "") + BaseImage := c.DefaultQuery("BaseImage", "") + PublicKey := c.DefaultQuery("PublicKey", "") + var PortsInt int - if PublicKey == "" { - c.String(http.StatusInternalServerError, fmt.Sprintf("error: %s", "Publickey not passed")) - } + if PublicKey == "" { + c.String(http.StatusInternalServerError, fmt.Sprintf("error: %s", "Publickey not passed")) + } - PublicKeyDecoded, err := b64.StdEncoding.DecodeString(PublicKey) - if err != nil { - c.String(http.StatusInternalServerError, fmt.Sprintf("error: %s", err)) - } + PublicKeyDecoded, err := b64.StdEncoding.DecodeString(PublicKey) + if err != nil { + c.String(http.StatusInternalServerError, fmt.Sprintf("error: %s", err)) + } - // Convert Get Request value to int - fmt.Sscanf(Ports, "%d", &PortsInt) + // Convert Get Request value to int + fmt.Sscanf(Ports, "%d", &PortsInt) - fmt.Println(string(PublicKeyDecoded[:])) + fmt.Println(string(PublicKeyDecoded[:])) - // Creates container and returns-back result to - // access container - resp, err := docker.BuildRunContainer(PortsInt, GPU, ContainerName, BaseImage, string(PublicKeyDecoded[:])) + // Creates container and returns-back result to + // access container + resp, err := docker.BuildRunContainer(PortsInt, GPU, ContainerName, BaseImage, string(PublicKeyDecoded[:])) - if err != nil { - c.String(http.StatusInternalServerError, fmt.Sprintf("error: %s", err)) - } + if err != nil { + c.String(http.StatusInternalServerError, fmt.Sprintf("error: %s", err)) + } - // Ensures that FRP is triggered only if a proxy address is provided - if ProxyIpAddr.Ipv4 != "" && c.Request.Host != "localhost:"+config.ServerPort && c.Request.Host != "0.0.0.0:"+config.ServerPort { - resp, err = frp.StartFRPCDockerContainer(ProxyIpAddr.Ipv4, lowestLatencyIpAddress.ServerPort, resp) - if err != nil { - c.String(http.StatusInternalServerError, fmt.Sprintf("error: %s", err)) - } - } + // Ensures that FRP is triggered only if a proxy address is provided + if ProxyIpAddr.Ipv4 != "" && c.Request.Host != "localhost:"+config.ServerPort && c.Request.Host != "0.0.0.0:"+config.ServerPort { + resp, err = frp.StartFRPCDockerContainer(ProxyIpAddr.Ipv4, lowestLatencyIpAddress.ServerPort, resp) + if err != nil { + c.String(http.StatusInternalServerError, fmt.Sprintf("error: %s", err)) + } + } - c.JSON(http.StatusOK, resp) - }) + c.JSON(http.StatusOK, resp) + }) - //Remove container - r.GET("/RemoveContainer", func(c *gin.Context) { - ID := c.DefaultQuery("id", "0") - if err := docker.StopAndRemoveContainer(ID); err != nil { - c.String(http.StatusInternalServerError, fmt.Sprintf("error: %s", err)) - } - c.String(http.StatusOK, "success") - }) + //Remove container + r.GET("/RemoveContainer", func(c *gin.Context) { + ID := c.DefaultQuery("id", "0") + if err := docker.StopAndRemoveContainer(ID); err != nil { + c.String(http.StatusInternalServerError, fmt.Sprintf("error: %s", err)) + } + c.String(http.StatusOK, "success") + }) - //Show images available - r.GET("/ShowImages", func(c *gin.Context) { - resp, err := docker.ViewAllContainers() - if err != nil { - c.String(http.StatusInternalServerError, fmt.Sprintf("error: %s", err)) - } - c.JSON(http.StatusOK, resp) - }) + //Show images available + r.GET("/ShowImages", func(c *gin.Context) { + resp, err := docker.ViewAllContainers() + if err != nil { + c.String(http.StatusInternalServerError, fmt.Sprintf("error: %s", err)) + } + c.JSON(http.StatusOK, resp) + }) - // Request for port no from Server with address - r.GET("/FRPPort", func(c *gin.Context) { - port, err := frp.StartFRPProxyFromRandom() - if err != nil { - c.String(http.StatusInternalServerError, fmt.Sprintf("error: %s", err)) - } + // Request for port no from Server with address + r.GET("/FRPPort", func(c *gin.Context) { + port, err := frp.StartFRPProxyFromRandom() + if err != nil { + c.String(http.StatusInternalServerError, fmt.Sprintf("error: %s", err)) + } - c.String(http.StatusOK, strconv.Itoa(port)) - }) + c.String(http.StatusOK, strconv.Itoa(port)) + }) - r.GET("/MAPPort", func(c *gin.Context) { - Ports := c.DefaultQuery("port", "0") - DomainName := c.DefaultQuery("domain_name", "0") - url, _, err := MapPort(Ports, DomainName) - if err != nil { - c.String(http.StatusInternalServerError, fmt.Sprintf("error: %s", err)) - } + r.GET("/MAPPort", func(c *gin.Context) { + Ports := c.DefaultQuery("port", "0") + DomainName := c.DefaultQuery("domain_name", "0") + url, _, err := MapPort(Ports, DomainName) + if err != nil { + c.String(http.StatusInternalServerError, fmt.Sprintf("error: %s", err)) + } - c.String(http.StatusOK, url) - }) + c.String(http.StatusOK, url) + }) - r.GET("/AddProxy", func(c *gin.Context) { - DomainName := c.DefaultQuery("domain_name", "") - ip_address := c.DefaultQuery("ip_address", "") - Ports := c.DefaultQuery("port", "") + //r.GET("/AddProxy", func(c *gin.Context) { + // DomainName := c.DefaultQuery("domain_name", "") + // ip_address := c.DefaultQuery("ip_address", "") + // Ports := c.DefaultQuery("port", "") + // + // if DomainName == "" || ip_address == "" || Ports == "" { + // c.String(http.StatusInternalServerError, fmt.Sprintf("All get parameters npt provided"+ + // " do ensure domain_name, ip_Address and port no is provided")) + // } + // + // SaveRegistration(DomainName, ip_address+":"+Ports) + // + // //_, ok := ReverseProxies[DomainName] + // //// To check if the subdomain entry exists + // //if ok { + // // c.String(http.StatusInternalServerError, fmt.Sprintf("The domain entry already exists as a reverse"+ + // // " proxy entry")) + // //} + // // + // //// added proxy as a map entry + // //ReverseProxies[DomainName] = ReverseProxy{IPAddress: ip_address, Port: Ports} + // + //}) - if DomainName == "" || ip_address == "" || Ports == "" { - c.String(http.StatusInternalServerError, fmt.Sprintf("All get parameters npt provided"+ - " do ensure domain_name, ip_Address and port no is provided")) - } + //r.GET("/RemoveProxy", func(c *gin.Context) { + // DomainName := c.DefaultQuery("domain_name", "") + // + // _, ok := ReverseProxies[DomainName] + // if !ok { + // c.String(http.StatusInternalServerError, fmt.Sprintf("Domain name does exist in entries of proxies")) + // } else { + // delete(ReverseProxies, DomainName) + // } + // + //}) - SaveRegistration(DomainName, ip_address+":"+Ports) + // If there is a proxy port specified + // then starts the FRP server + //if config.FRPServerPort != "0" { + // go frp.StartFRPProxyFromRandom() + //} - //_, ok := ReverseProxies[DomainName] - //// To check if the subdomain entry exists - //if ok { - // c.String(http.StatusInternalServerError, fmt.Sprintf("The domain entry already exists as a reverse"+ - // " proxy entry")) - //} - // - //// added proxy as a map entry - //ReverseProxies[DomainName] = ReverseProxy{IPAddress: ip_address, Port: Ports} + // TODO check if IPV6 or Proxy port is specified + // if not update current entry as proxy address + // with appropriate port on IP Table + if config.BehindNAT == "True" { + // Remove nodes currently not pingable + clientIPTable.RemoveOfflineNodes() - }) + table, err := p2p.ReadIpTable() + if err != nil { + return nil, err + } - r.GET("/RemoveProxy", func(c *gin.Context) { - DomainName := c.DefaultQuery("domain_name", "") + var lowestLatency int64 + // random large number + lowestLatency = 10000000 - _, ok := ReverseProxies[DomainName] - if !ok { - c.String(http.StatusInternalServerError, fmt.Sprintf("Domain name does exist in entries of proxies")) - } else { - delete(ReverseProxies, DomainName) - } + for i, _ := range table.IpAddress { + // Checks if the ping is the lowest and if the following node is acting as a proxy + //if table.IpAddress[i].Latency.Milliseconds() < lowestLatency && table.IpAddress[i].ProxyPort != "" { + if table.IpAddress[i].Latency.Milliseconds() < lowestLatency && table.IpAddress[i].NAT != "" { + lowestLatency = table.IpAddress[i].Latency.Milliseconds() + lowestLatencyIpAddress = table.IpAddress[i] + } + } - }) + // If there is an identified node + if lowestLatency != 10000000 { + serverPort, err := frp.GetFRPServerPort("http://" + lowestLatencyIpAddress.Ipv4 + ":" + lowestLatencyIpAddress.ServerPort) + if err != nil { + return nil, err + } + // Create 3 second delay to allow FRP server to start + time.Sleep(1 * time.Second) + // Starts FRP as a client with + proxyPort, err := frp.StartFRPClientForServer(lowestLatencyIpAddress.Ipv4, serverPort, config.ServerPort, "") + if err != nil { + return nil, err + } - // If there is a proxy port specified - // then starts the FRP server - //if config.FRPServerPort != "0" { - // go frp.StartFRPProxyFromRandom() - //} + // updating with the current proxy address + ProxyIpAddr.Ipv4 = lowestLatencyIpAddress.Ipv4 + ProxyIpAddr.ServerPort = proxyPort + ProxyIpAddr.Name = config.MachineName + ProxyIpAddr.NAT = "False" + ProxyIpAddr.ProxyServer = "False" + ProxyIpAddr.EscapeImplementation = "FRP" - // TODO check if IPV6 or Proxy port is specified - // if not update current entry as proxy address - // with appropriate port on IP Table - if config.BehindNAT == "True" { - // Remove nodes currently not pingable - clientIPTable.RemoveOfflineNodes() + // Sorry Jan it's a string + // Yes I could convert it + // to a boolean operator + // But I am way too tired + if config.BareMetal == "True" { + _, SSHPort, err := MapPort("22", "") + if err != nil { + return nil, err + } + ProxyIpAddr.BareMetalSSHPort = SSHPort + } - table, err := p2p.ReadIpTable() - if err != nil { - return nil, err - } + //ProxyIpAddr.CustomInformationKey = p2p.GenerateHashSHA256(config.IPTableKey) - var lowestLatency int64 - // random large number - lowestLatency = 10000000 + // append the following to the ip table + table.IpAddress = append(table.IpAddress, ProxyIpAddr) + // write information back to the IP Table + err = table.WriteIpTable() + if err != nil { + return nil, err + } + // update ip table + go func() error { + err := clientIPTable.UpdateIpTableListClient() + if err != nil { + fmt.Println(err) + return err + } + return nil + }() + } - for i, _ := range table.IpAddress { - // Checks if the ping is the lowest and if the following node is acting as a proxy - //if table.IpAddress[i].Latency.Milliseconds() < lowestLatency && table.IpAddress[i].ProxyPort != "" { - if table.IpAddress[i].Latency.Milliseconds() < lowestLatency && table.IpAddress[i].NAT != "" { - lowestLatency = table.IpAddress[i].Latency.Milliseconds() - lowestLatencyIpAddress = table.IpAddress[i] - } - } + } - // If there is an identified node - if lowestLatency != 10000000 { - serverPort, err := frp.GetFRPServerPort("http://" + lowestLatencyIpAddress.Ipv4 + ":" + lowestLatencyIpAddress.ServerPort) - if err != nil { - return nil, err - } - // Create 3 second delay to allow FRP server to start - time.Sleep(1 * time.Second) - // Starts FRP as a client with - proxyPort, err := frp.StartFRPClientForServer(lowestLatencyIpAddress.Ipv4, serverPort, config.ServerPort, "") - if err != nil { - return nil, err - } + if config.ProxyPort != "" { + go ProxyRun(config.ProxyPort) + } - // updating with the current proxy address - ProxyIpAddr.Ipv4 = lowestLatencyIpAddress.Ipv4 - ProxyIpAddr.ServerPort = proxyPort - ProxyIpAddr.Name = config.MachineName - ProxyIpAddr.NAT = "False" - ProxyIpAddr.ProxyServer = "False" - ProxyIpAddr.EscapeImplementation = "FRP" + // Run gin server on the specified port + go r.Run(":" + config.ServerPort) - // Sorry Jan it's a string - // Yes I could convert it - // to a boolean operator - // But I am way too tired - if config.BareMetal == "True" { - _, SSHPort, err := MapPort("22", "") - if err != nil { - return nil, err - } - ProxyIpAddr.BareMetalSSHPort = SSHPort - } - - //ProxyIpAddr.CustomInformationKey = p2p.GenerateHashSHA256(config.IPTableKey) - - // append the following to the ip table - table.IpAddress = append(table.IpAddress, ProxyIpAddr) - // write information back to the IP Table - err = table.WriteIpTable() - if err != nil { - return nil, err - } - // update ip table - go func() error { - err := clientIPTable.UpdateIpTableListClient() - if err != nil { - fmt.Println(err) - return err - } - return nil - }() - } - - } - - if config.ProxyPort != "" { - go ProxyRun(config.ProxyPort) - } - - // Run gin server on the specified port - go r.Run(":" + config.ServerPort) - - return r, nil + return r, nil } func MapPort(port string, domainName string) (string, string, error) { - //Get Server port based on the config file - config, err := config.ConfigInit(nil, nil) - if err != nil { - return "", "", err - } + //Get Server port based on the config file + config, err := config.ConfigInit(nil, nil) + if err != nil { + return "", "", err + } - // update IPTable with new port and ip address and update ip table - var ProxyIpAddr p2p.IpAddress - var lowestLatencyIpAddress p2p.IpAddress + // update IPTable with new port and ip address and update ip table + var ProxyIpAddr p2p.IpAddress + var lowestLatencyIpAddress p2p.IpAddress - clientIPTable.RemoveOfflineNodes() + clientIPTable.RemoveOfflineNodes() - table, err := p2p.ReadIpTable() - if err != nil { - return "", "", err - } + table, err := p2p.ReadIpTable() + if err != nil { + return "", "", err + } - var lowestLatency int64 - // random large number - lowestLatency = 10000000 + var lowestLatency int64 + // random large number + lowestLatency = 10000000 - for i, _ := range table.IpAddress { - // Checks if the ping is the lowest and if the following node is acting as a proxy - //if table.IpAddress[i].Latency.Milliseconds() < lowestLatency && table.IpAddress[i].ProxyPort != "" { - if table.IpAddress[i].Latency.Milliseconds() < lowestLatency && table.IpAddress[i].NAT != "" { - lowestLatency = table.IpAddress[i].Latency.Milliseconds() - lowestLatencyIpAddress = table.IpAddress[i] - } - } + for i, _ := range table.IpAddress { + // Checks if the ping is the lowest and if the following node is acting as a proxy + //if table.IpAddress[i].Latency.Milliseconds() < lowestLatency && table.IpAddress[i].ProxyPort != "" { + if table.IpAddress[i].Latency.Milliseconds() < lowestLatency && table.IpAddress[i].NAT != "" { + // Filter based on nodes with proxy enabled + if domainName != "" && table.IpAddress[i].ProxyServer == "Yes" { + lowestLatency = table.IpAddress[i].Latency.Milliseconds() + lowestLatencyIpAddress = table.IpAddress[i] + continue + } + lowestLatency = table.IpAddress[i].Latency.Milliseconds() + lowestLatencyIpAddress = table.IpAddress[i] + } + } - // If there is an identified node - if lowestLatency != 10000000 { - serverPort, err := frp.GetFRPServerPort("http://" + lowestLatencyIpAddress.Ipv4 + ":" + lowestLatencyIpAddress.ServerPort) - if err != nil { - return "", "", err - } - // Create 3 second delay to allow FRP server to start - time.Sleep(1 * time.Second) - // Starts FRP as a client with - proxyPort, err := frp.StartFRPClientForServer(lowestLatencyIpAddress.Ipv4, serverPort, port, "") - if err != nil { - return "", "", err - } + // If there is an identified node + if lowestLatency != 10000000 { + serverPort, err := frp.GetFRPServerPort("http://" + lowestLatencyIpAddress.Ipv4 + ":" + lowestLatencyIpAddress.ServerPort) + if err != nil { + return "", "", err + } + // Create 3 second delay to allow FRP server to start + time.Sleep(1 * time.Second) + // Starts FRP as a client with + proxyPort, err := frp.StartFRPClientForServer(lowestLatencyIpAddress.Ipv4, serverPort, port, "") + if err != nil { + return "", "", err + } - // updating with the current proxy address - ProxyIpAddr.Ipv4 = lowestLatencyIpAddress.Ipv4 - ProxyIpAddr.ServerPort = proxyPort - ProxyIpAddr.Name = config.MachineName - ProxyIpAddr.NAT = "False" - ProxyIpAddr.EscapeImplementation = "FRP" - //ProxyIpAddr.CustomInformationKey = p2p.GenerateHashSHA256(config.IPTableKey) - } + // Doing the proxy mapping for the domain name + if domainName != "" { + SaveRegistration(domainName, lowestLatencyIpAddress.Ipv4+":"+proxyPort) + } - return ProxyIpAddr.Ipv4 + ":" + ProxyIpAddr.ServerPort, ProxyIpAddr.ServerPort, nil + // updating with the current proxy address + ProxyIpAddr.Ipv4 = lowestLatencyIpAddress.Ipv4 + ProxyIpAddr.ServerPort = proxyPort + ProxyIpAddr.Name = config.MachineName + ProxyIpAddr.NAT = "False" + ProxyIpAddr.EscapeImplementation = "FRP" + //ProxyIpAddr.CustomInformationKey = p2p.GenerateHashSHA256(config.IPTableKey) + } else { + return "", "", errors.New("proxy IP not found") + } + + return ProxyIpAddr.Ipv4 + ":" + ProxyIpAddr.ServerPort, ProxyIpAddr.ServerPort, nil } From 9192901e255ebcf4632a46a7f11d157a5b804f2a Mon Sep 17 00:00:00 2001 From: Akilan Date: Fri, 23 Aug 2024 02:02:51 +0100 Subject: [PATCH 03/18] added automatic entry for nodes not behind NAT --- server/server.go | 60 +++++++++++++++++++++++++++++++----------------- 1 file changed, 39 insertions(+), 21 deletions(-) diff --git a/server/server.go b/server/server.go index c117812..81614ec 100644 --- a/server/server.go +++ b/server/server.go @@ -242,14 +242,15 @@ func Server() (*gin.Engine, error) { // go frp.StartFRPProxyFromRandom() //} + // Remove nodes currently not pingable + clientIPTable.RemoveOfflineNodes() + + table, err := p2p.ReadIpTable() + // TODO check if IPV6 or Proxy port is specified // if not update current entry as proxy address // with appropriate port on IP Table if config.BehindNAT == "True" { - // Remove nodes currently not pingable - clientIPTable.RemoveOfflineNodes() - - table, err := p2p.ReadIpTable() if err != nil { return nil, err } @@ -289,10 +290,6 @@ func Server() (*gin.Engine, error) { ProxyIpAddr.ProxyServer = "False" ProxyIpAddr.EscapeImplementation = "FRP" - // Sorry Jan it's a string - // Yes I could convert it - // to a boolean operator - // But I am way too tired if config.BareMetal == "True" { _, SSHPort, err := MapPort("22", "") if err != nil { @@ -306,23 +303,44 @@ func Server() (*gin.Engine, error) { // append the following to the ip table table.IpAddress = append(table.IpAddress, ProxyIpAddr) // write information back to the IP Table - err = table.WriteIpTable() - if err != nil { - return nil, err - } - // update ip table - go func() error { - err := clientIPTable.UpdateIpTableListClient() - if err != nil { - fmt.Println(err) - return err - } - return nil - }() } + } else { + ProxyIpAddr.Ipv4, err = p2p.CurrentPublicIP() + if err != nil { + fmt.Println(err) + } + ProxyIpAddr.ServerPort = config.ServerPort + ProxyIpAddr.Name = config.MachineName + ProxyIpAddr.NAT = "False" + if config.ProxyPort != "" { + ProxyIpAddr.ProxyServer = "False" + } + ProxyIpAddr.EscapeImplementation = "" + if config.BareMetal == "True" { + ProxyIpAddr.BareMetalSSHPort = "22" + } + + table.IpAddress = append(table.IpAddress, ProxyIpAddr) + } + // Writing results to the IPTable + err = table.WriteIpTable() + if err != nil { + return nil, err + } + + // update ip table + go func() error { + err := clientIPTable.UpdateIpTableListClient() + if err != nil { + fmt.Println(err) + return err + } + return nil + }() + if config.ProxyPort != "" { go ProxyRun(config.ProxyPort) } From 0c1e6edcbc5bdc117ea7e5d3b863c82c5a19a7e3 Mon Sep 17 00:00:00 2001 From: Akilan Date: Fri, 23 Aug 2024 02:18:06 +0100 Subject: [PATCH 04/18] changed state for Proxy default for IPTables --- server/server.go | 684 +++++++++++++++++++++++------------------------ 1 file changed, 342 insertions(+), 342 deletions(-) diff --git a/server/server.go b/server/server.go index 81614ec..592a910 100644 --- a/server/server.go +++ b/server/server.go @@ -1,422 +1,422 @@ package server import ( - b64 "encoding/base64" - "encoding/json" - "errors" - "fmt" - "github.com/Akilan1999/p2p-rendering-computation/client/clientIPTable" - "github.com/Akilan1999/p2p-rendering-computation/config" - "github.com/Akilan1999/p2p-rendering-computation/p2p" - "github.com/Akilan1999/p2p-rendering-computation/p2p/frp" - "github.com/Akilan1999/p2p-rendering-computation/server/docker" - "github.com/gin-gonic/gin" - "io/ioutil" - "net/http" - "strconv" - "time" + b64 "encoding/base64" + "encoding/json" + "errors" + "fmt" + "github.com/Akilan1999/p2p-rendering-computation/client/clientIPTable" + "github.com/Akilan1999/p2p-rendering-computation/config" + "github.com/Akilan1999/p2p-rendering-computation/p2p" + "github.com/Akilan1999/p2p-rendering-computation/p2p/frp" + "github.com/Akilan1999/p2p-rendering-computation/server/docker" + "github.com/gin-gonic/gin" + "io/ioutil" + "net/http" + "strconv" + "time" ) type ReverseProxy struct { - IPAddress string - Port string + IPAddress string + Port string } // ReverseProxies Reverse to the map such as ReverseProxies[]ReverseProxy type var ReverseProxies map[string]ReverseProxy func Server() (*gin.Engine, error) { - r := gin.Default() + r := gin.Default() - // "The make function allocates and initializes a hash map data - //structure and returns a map value that points to it. - //The specifics of that data structure are an implementation - //detail of the runtime and are not specified by the language itself." - // source: https://go.dev/blog/maps - ReverseProxies = make(map[string]ReverseProxy) + // "The make function allocates and initializes a hash map data + //structure and returns a map value that points to it. + //The specifics of that data structure are an implementation + //detail of the runtime and are not specified by the language itself." + // source: https://go.dev/blog/maps + ReverseProxies = make(map[string]ReverseProxy) - //Get Server port based on the config file - config, err := config.ConfigInit(nil, nil) - if err != nil { - return nil, err - } + //Get Server port based on the config file + config, err := config.ConfigInit(nil, nil) + if err != nil { + return nil, err + } - // update IPTable with new port and ip address and update ip table - var ProxyIpAddr p2p.IpAddress - var lowestLatencyIpAddress p2p.IpAddress + // update IPTable with new port and ip address and update ip table + var ProxyIpAddr p2p.IpAddress + var lowestLatencyIpAddress p2p.IpAddress - // Gets default information of the server - r.GET("/server_info", func(c *gin.Context) { - c.JSON(http.StatusOK, ServerInfo()) - }) + // Gets default information of the server + r.GET("/server_info", func(c *gin.Context) { + c.JSON(http.StatusOK, ServerInfo()) + }) - // Speed test with 50 mbps - r.GET("/50", func(c *gin.Context) { - // Get Path from config - c.File(config.SpeedTestFile) - }) + // Speed test with 50 mbps + r.GET("/50", func(c *gin.Context) { + // Get Path from config + c.File(config.SpeedTestFile) + }) - // Route build to do a speed test - r.GET("/upload", func(c *gin.Context) { - file, _ := c.FormFile("file") + // Route build to do a speed test + r.GET("/upload", func(c *gin.Context) { + file, _ := c.FormFile("file") - // Upload the file to specific dst. - // c.SaveUploadedFile(file, dst) + // Upload the file to specific dst. + // c.SaveUploadedFile(file, dst) - c.String(http.StatusOK, fmt.Sprintf("'%s' uploaded!", file.Filename)) - }) + c.String(http.StatusOK, fmt.Sprintf("'%s' uploaded!", file.Filename)) + }) - //Gets Ip Table from server node - r.POST("/IpTable", func(c *gin.Context) { - // Getting IPV4 address of client - var ClientHost p2p.IpAddress + //Gets Ip Table from server node + r.POST("/IpTable", func(c *gin.Context) { + // Getting IPV4 address of client + var ClientHost p2p.IpAddress - if p2p.Ip4or6(c.ClientIP()) == "version 6" { - ClientHost.Ipv6 = c.ClientIP() - } else { - ClientHost.Ipv4 = c.ClientIP() - } + if p2p.Ip4or6(c.ClientIP()) == "version 6" { + ClientHost.Ipv6 = c.ClientIP() + } else { + ClientHost.Ipv4 = c.ClientIP() + } - // Variable to store IP table information - var IPTable p2p.IpAddresses + // Variable to store IP table information + var IPTable p2p.IpAddresses - // Receive file from POST request - body, err := c.FormFile("json") - if err != nil { - c.String(http.StatusOK, fmt.Sprint(err)) - } + // Receive file from POST request + body, err := c.FormFile("json") + if err != nil { + c.String(http.StatusOK, fmt.Sprint(err)) + } - // Open file - open, err := body.Open() - if err != nil { - c.String(http.StatusOK, fmt.Sprint(err)) - } + // Open file + open, err := body.Open() + if err != nil { + c.String(http.StatusOK, fmt.Sprint(err)) + } - // Open received file - file, err := ioutil.ReadAll(open) - if err != nil { - c.String(http.StatusOK, fmt.Sprint(err)) - } + // Open received file + file, err := ioutil.ReadAll(open) + if err != nil { + c.String(http.StatusOK, fmt.Sprint(err)) + } - json.Unmarshal(file, &IPTable) + json.Unmarshal(file, &IPTable) - //Add Client IP address to IPTable struct - IPTable.IpAddress = append(IPTable.IpAddress, ClientHost) + //Add Client IP address to IPTable struct + IPTable.IpAddress = append(IPTable.IpAddress, ClientHost) - // Runs speed test to return only servers in the IP table pingable - err = IPTable.SpeedTestUpdatedIPTable() - if err != nil { - c.String(http.StatusOK, fmt.Sprint(err)) - } + // Runs speed test to return only servers in the IP table pingable + err = IPTable.SpeedTestUpdatedIPTable() + if err != nil { + c.String(http.StatusOK, fmt.Sprint(err)) + } - // Reads IP addresses from ip table - IpAddresses, err := p2p.ReadIpTable() - if err != nil { - c.String(http.StatusOK, fmt.Sprint(err)) - } + // Reads IP addresses from ip table + IpAddresses, err := p2p.ReadIpTable() + if err != nil { + c.String(http.StatusOK, fmt.Sprint(err)) + } - c.JSON(http.StatusOK, IpAddresses) - }) + c.JSON(http.StatusOK, IpAddresses) + }) - // Starts docker container in server - r.GET("/startcontainer", func(c *gin.Context) { - // Get Number of ports to open and whether to use GPU or not - Ports := c.DefaultQuery("ports", "0") - GPU := c.DefaultQuery("GPU", "false") - ContainerName := c.DefaultQuery("ContainerName", "") - BaseImage := c.DefaultQuery("BaseImage", "") - PublicKey := c.DefaultQuery("PublicKey", "") - var PortsInt int + // Starts docker container in server + r.GET("/startcontainer", func(c *gin.Context) { + // Get Number of ports to open and whether to use GPU or not + Ports := c.DefaultQuery("ports", "0") + GPU := c.DefaultQuery("GPU", "false") + ContainerName := c.DefaultQuery("ContainerName", "") + BaseImage := c.DefaultQuery("BaseImage", "") + PublicKey := c.DefaultQuery("PublicKey", "") + var PortsInt int - if PublicKey == "" { - c.String(http.StatusInternalServerError, fmt.Sprintf("error: %s", "Publickey not passed")) - } + if PublicKey == "" { + c.String(http.StatusInternalServerError, fmt.Sprintf("error: %s", "Publickey not passed")) + } - PublicKeyDecoded, err := b64.StdEncoding.DecodeString(PublicKey) - if err != nil { - c.String(http.StatusInternalServerError, fmt.Sprintf("error: %s", err)) - } + PublicKeyDecoded, err := b64.StdEncoding.DecodeString(PublicKey) + if err != nil { + c.String(http.StatusInternalServerError, fmt.Sprintf("error: %s", err)) + } - // Convert Get Request value to int - fmt.Sscanf(Ports, "%d", &PortsInt) + // Convert Get Request value to int + fmt.Sscanf(Ports, "%d", &PortsInt) - fmt.Println(string(PublicKeyDecoded[:])) + fmt.Println(string(PublicKeyDecoded[:])) - // Creates container and returns-back result to - // access container - resp, err := docker.BuildRunContainer(PortsInt, GPU, ContainerName, BaseImage, string(PublicKeyDecoded[:])) + // Creates container and returns-back result to + // access container + resp, err := docker.BuildRunContainer(PortsInt, GPU, ContainerName, BaseImage, string(PublicKeyDecoded[:])) - if err != nil { - c.String(http.StatusInternalServerError, fmt.Sprintf("error: %s", err)) - } + if err != nil { + c.String(http.StatusInternalServerError, fmt.Sprintf("error: %s", err)) + } - // Ensures that FRP is triggered only if a proxy address is provided - if ProxyIpAddr.Ipv4 != "" && c.Request.Host != "localhost:"+config.ServerPort && c.Request.Host != "0.0.0.0:"+config.ServerPort { - resp, err = frp.StartFRPCDockerContainer(ProxyIpAddr.Ipv4, lowestLatencyIpAddress.ServerPort, resp) - if err != nil { - c.String(http.StatusInternalServerError, fmt.Sprintf("error: %s", err)) - } - } + // Ensures that FRP is triggered only if a proxy address is provided + if ProxyIpAddr.Ipv4 != "" && c.Request.Host != "localhost:"+config.ServerPort && c.Request.Host != "0.0.0.0:"+config.ServerPort { + resp, err = frp.StartFRPCDockerContainer(ProxyIpAddr.Ipv4, lowestLatencyIpAddress.ServerPort, resp) + if err != nil { + c.String(http.StatusInternalServerError, fmt.Sprintf("error: %s", err)) + } + } - c.JSON(http.StatusOK, resp) - }) + c.JSON(http.StatusOK, resp) + }) - //Remove container - r.GET("/RemoveContainer", func(c *gin.Context) { - ID := c.DefaultQuery("id", "0") - if err := docker.StopAndRemoveContainer(ID); err != nil { - c.String(http.StatusInternalServerError, fmt.Sprintf("error: %s", err)) - } - c.String(http.StatusOK, "success") - }) + //Remove container + r.GET("/RemoveContainer", func(c *gin.Context) { + ID := c.DefaultQuery("id", "0") + if err := docker.StopAndRemoveContainer(ID); err != nil { + c.String(http.StatusInternalServerError, fmt.Sprintf("error: %s", err)) + } + c.String(http.StatusOK, "success") + }) - //Show images available - r.GET("/ShowImages", func(c *gin.Context) { - resp, err := docker.ViewAllContainers() - if err != nil { - c.String(http.StatusInternalServerError, fmt.Sprintf("error: %s", err)) - } - c.JSON(http.StatusOK, resp) - }) + //Show images available + r.GET("/ShowImages", func(c *gin.Context) { + resp, err := docker.ViewAllContainers() + if err != nil { + c.String(http.StatusInternalServerError, fmt.Sprintf("error: %s", err)) + } + c.JSON(http.StatusOK, resp) + }) - // Request for port no from Server with address - r.GET("/FRPPort", func(c *gin.Context) { - port, err := frp.StartFRPProxyFromRandom() - if err != nil { - c.String(http.StatusInternalServerError, fmt.Sprintf("error: %s", err)) - } + // Request for port no from Server with address + r.GET("/FRPPort", func(c *gin.Context) { + port, err := frp.StartFRPProxyFromRandom() + if err != nil { + c.String(http.StatusInternalServerError, fmt.Sprintf("error: %s", err)) + } - c.String(http.StatusOK, strconv.Itoa(port)) - }) + c.String(http.StatusOK, strconv.Itoa(port)) + }) - r.GET("/MAPPort", func(c *gin.Context) { - Ports := c.DefaultQuery("port", "0") - DomainName := c.DefaultQuery("domain_name", "0") - url, _, err := MapPort(Ports, DomainName) - if err != nil { - c.String(http.StatusInternalServerError, fmt.Sprintf("error: %s", err)) - } + r.GET("/MAPPort", func(c *gin.Context) { + Ports := c.DefaultQuery("port", "0") + DomainName := c.DefaultQuery("domain_name", "0") + url, _, err := MapPort(Ports, DomainName) + if err != nil { + c.String(http.StatusInternalServerError, fmt.Sprintf("error: %s", err)) + } - c.String(http.StatusOK, url) - }) + c.String(http.StatusOK, url) + }) - //r.GET("/AddProxy", func(c *gin.Context) { - // DomainName := c.DefaultQuery("domain_name", "") - // ip_address := c.DefaultQuery("ip_address", "") - // Ports := c.DefaultQuery("port", "") - // - // if DomainName == "" || ip_address == "" || Ports == "" { - // c.String(http.StatusInternalServerError, fmt.Sprintf("All get parameters npt provided"+ - // " do ensure domain_name, ip_Address and port no is provided")) - // } - // - // SaveRegistration(DomainName, ip_address+":"+Ports) - // - // //_, ok := ReverseProxies[DomainName] - // //// To check if the subdomain entry exists - // //if ok { - // // c.String(http.StatusInternalServerError, fmt.Sprintf("The domain entry already exists as a reverse"+ - // // " proxy entry")) - // //} - // // - // //// added proxy as a map entry - // //ReverseProxies[DomainName] = ReverseProxy{IPAddress: ip_address, Port: Ports} - // - //}) + //r.GET("/AddProxy", func(c *gin.Context) { + // DomainName := c.DefaultQuery("domain_name", "") + // ip_address := c.DefaultQuery("ip_address", "") + // Ports := c.DefaultQuery("port", "") + // + // if DomainName == "" || ip_address == "" || Ports == "" { + // c.String(http.StatusInternalServerError, fmt.Sprintf("All get parameters npt provided"+ + // " do ensure domain_name, ip_Address and port no is provided")) + // } + // + // SaveRegistration(DomainName, ip_address+":"+Ports) + // + // //_, ok := ReverseProxies[DomainName] + // //// To check if the subdomain entry exists + // //if ok { + // // c.String(http.StatusInternalServerError, fmt.Sprintf("The domain entry already exists as a reverse"+ + // // " proxy entry")) + // //} + // // + // //// added proxy as a map entry + // //ReverseProxies[DomainName] = ReverseProxy{IPAddress: ip_address, Port: Ports} + // + //}) - //r.GET("/RemoveProxy", func(c *gin.Context) { - // DomainName := c.DefaultQuery("domain_name", "") - // - // _, ok := ReverseProxies[DomainName] - // if !ok { - // c.String(http.StatusInternalServerError, fmt.Sprintf("Domain name does exist in entries of proxies")) - // } else { - // delete(ReverseProxies, DomainName) - // } - // - //}) + //r.GET("/RemoveProxy", func(c *gin.Context) { + // DomainName := c.DefaultQuery("domain_name", "") + // + // _, ok := ReverseProxies[DomainName] + // if !ok { + // c.String(http.StatusInternalServerError, fmt.Sprintf("Domain name does exist in entries of proxies")) + // } else { + // delete(ReverseProxies, DomainName) + // } + // + //}) - // If there is a proxy port specified - // then starts the FRP server - //if config.FRPServerPort != "0" { - // go frp.StartFRPProxyFromRandom() - //} + // If there is a proxy port specified + // then starts the FRP server + //if config.FRPServerPort != "0" { + // go frp.StartFRPProxyFromRandom() + //} - // Remove nodes currently not pingable - clientIPTable.RemoveOfflineNodes() + // Remove nodes currently not pingable + clientIPTable.RemoveOfflineNodes() - table, err := p2p.ReadIpTable() + table, err := p2p.ReadIpTable() - // TODO check if IPV6 or Proxy port is specified - // if not update current entry as proxy address - // with appropriate port on IP Table - if config.BehindNAT == "True" { - if err != nil { - return nil, err - } + // TODO check if IPV6 or Proxy port is specified + // if not update current entry as proxy address + // with appropriate port on IP Table + if config.BehindNAT == "True" { + if err != nil { + return nil, err + } - var lowestLatency int64 - // random large number - lowestLatency = 10000000 + var lowestLatency int64 + // random large number + lowestLatency = 10000000 - for i, _ := range table.IpAddress { - // Checks if the ping is the lowest and if the following node is acting as a proxy - //if table.IpAddress[i].Latency.Milliseconds() < lowestLatency && table.IpAddress[i].ProxyPort != "" { - if table.IpAddress[i].Latency.Milliseconds() < lowestLatency && table.IpAddress[i].NAT != "" { - lowestLatency = table.IpAddress[i].Latency.Milliseconds() - lowestLatencyIpAddress = table.IpAddress[i] - } - } + for i, _ := range table.IpAddress { + // Checks if the ping is the lowest and if the following node is acting as a proxy + //if table.IpAddress[i].Latency.Milliseconds() < lowestLatency && table.IpAddress[i].ProxyPort != "" { + if table.IpAddress[i].Latency.Milliseconds() < lowestLatency && table.IpAddress[i].NAT != "" { + lowestLatency = table.IpAddress[i].Latency.Milliseconds() + lowestLatencyIpAddress = table.IpAddress[i] + } + } - // If there is an identified node - if lowestLatency != 10000000 { - serverPort, err := frp.GetFRPServerPort("http://" + lowestLatencyIpAddress.Ipv4 + ":" + lowestLatencyIpAddress.ServerPort) - if err != nil { - return nil, err - } - // Create 3 second delay to allow FRP server to start - time.Sleep(1 * time.Second) - // Starts FRP as a client with - proxyPort, err := frp.StartFRPClientForServer(lowestLatencyIpAddress.Ipv4, serverPort, config.ServerPort, "") - if err != nil { - return nil, err - } + // If there is an identified node + if lowestLatency != 10000000 { + serverPort, err := frp.GetFRPServerPort("http://" + lowestLatencyIpAddress.Ipv4 + ":" + lowestLatencyIpAddress.ServerPort) + if err != nil { + return nil, err + } + // Create 3 second delay to allow FRP server to start + time.Sleep(1 * time.Second) + // Starts FRP as a client with + proxyPort, err := frp.StartFRPClientForServer(lowestLatencyIpAddress.Ipv4, serverPort, config.ServerPort, "") + if err != nil { + return nil, err + } - // updating with the current proxy address - ProxyIpAddr.Ipv4 = lowestLatencyIpAddress.Ipv4 - ProxyIpAddr.ServerPort = proxyPort - ProxyIpAddr.Name = config.MachineName - ProxyIpAddr.NAT = "False" - ProxyIpAddr.ProxyServer = "False" - ProxyIpAddr.EscapeImplementation = "FRP" + // updating with the current proxy address + ProxyIpAddr.Ipv4 = lowestLatencyIpAddress.Ipv4 + ProxyIpAddr.ServerPort = proxyPort + ProxyIpAddr.Name = config.MachineName + ProxyIpAddr.NAT = "False" + ProxyIpAddr.ProxyServer = "False" + ProxyIpAddr.EscapeImplementation = "FRP" - if config.BareMetal == "True" { - _, SSHPort, err := MapPort("22", "") - if err != nil { - return nil, err - } - ProxyIpAddr.BareMetalSSHPort = SSHPort - } + if config.BareMetal == "True" { + _, SSHPort, err := MapPort("22", "") + if err != nil { + return nil, err + } + ProxyIpAddr.BareMetalSSHPort = SSHPort + } - //ProxyIpAddr.CustomInformationKey = p2p.GenerateHashSHA256(config.IPTableKey) + //ProxyIpAddr.CustomInformationKey = p2p.GenerateHashSHA256(config.IPTableKey) - // append the following to the ip table - table.IpAddress = append(table.IpAddress, ProxyIpAddr) - // write information back to the IP Table - } + // append the following to the ip table + table.IpAddress = append(table.IpAddress, ProxyIpAddr) + // write information back to the IP Table + } - } else { - ProxyIpAddr.Ipv4, err = p2p.CurrentPublicIP() - if err != nil { - fmt.Println(err) - } - ProxyIpAddr.ServerPort = config.ServerPort - ProxyIpAddr.Name = config.MachineName - ProxyIpAddr.NAT = "False" - if config.ProxyPort != "" { - ProxyIpAddr.ProxyServer = "False" - } - ProxyIpAddr.EscapeImplementation = "" - if config.BareMetal == "True" { - ProxyIpAddr.BareMetalSSHPort = "22" - } + } else { + ProxyIpAddr.Ipv4, err = p2p.CurrentPublicIP() + if err != nil { + fmt.Println(err) + } + ProxyIpAddr.ServerPort = config.ServerPort + ProxyIpAddr.Name = config.MachineName + ProxyIpAddr.NAT = "False" + if config.ProxyPort != "" { + ProxyIpAddr.ProxyServer = "True" + } + ProxyIpAddr.EscapeImplementation = "" + if config.BareMetal == "True" { + ProxyIpAddr.BareMetalSSHPort = "22" + } - table.IpAddress = append(table.IpAddress, ProxyIpAddr) + table.IpAddress = append(table.IpAddress, ProxyIpAddr) - } + } - // Writing results to the IPTable - err = table.WriteIpTable() - if err != nil { - return nil, err - } + // Writing results to the IPTable + err = table.WriteIpTable() + if err != nil { + return nil, err + } - // update ip table - go func() error { - err := clientIPTable.UpdateIpTableListClient() - if err != nil { - fmt.Println(err) - return err - } - return nil - }() + // update ip table + go func() error { + err := clientIPTable.UpdateIpTableListClient() + if err != nil { + fmt.Println(err) + return err + } + return nil + }() - if config.ProxyPort != "" { - go ProxyRun(config.ProxyPort) - } + if config.ProxyPort != "" { + go ProxyRun(config.ProxyPort) + } - // Run gin server on the specified port - go r.Run(":" + config.ServerPort) + // Run gin server on the specified port + go r.Run(":" + config.ServerPort) - return r, nil + return r, nil } func MapPort(port string, domainName string) (string, string, error) { - //Get Server port based on the config file - config, err := config.ConfigInit(nil, nil) - if err != nil { - return "", "", err - } + //Get Server port based on the config file + config, err := config.ConfigInit(nil, nil) + if err != nil { + return "", "", err + } - // update IPTable with new port and ip address and update ip table - var ProxyIpAddr p2p.IpAddress - var lowestLatencyIpAddress p2p.IpAddress + // update IPTable with new port and ip address and update ip table + var ProxyIpAddr p2p.IpAddress + var lowestLatencyIpAddress p2p.IpAddress - clientIPTable.RemoveOfflineNodes() + clientIPTable.RemoveOfflineNodes() - table, err := p2p.ReadIpTable() - if err != nil { - return "", "", err - } + table, err := p2p.ReadIpTable() + if err != nil { + return "", "", err + } - var lowestLatency int64 - // random large number - lowestLatency = 10000000 + var lowestLatency int64 + // random large number + lowestLatency = 10000000 - for i, _ := range table.IpAddress { - // Checks if the ping is the lowest and if the following node is acting as a proxy - //if table.IpAddress[i].Latency.Milliseconds() < lowestLatency && table.IpAddress[i].ProxyPort != "" { - if table.IpAddress[i].Latency.Milliseconds() < lowestLatency && table.IpAddress[i].NAT != "" { - // Filter based on nodes with proxy enabled - if domainName != "" && table.IpAddress[i].ProxyServer == "Yes" { - lowestLatency = table.IpAddress[i].Latency.Milliseconds() - lowestLatencyIpAddress = table.IpAddress[i] - continue - } - lowestLatency = table.IpAddress[i].Latency.Milliseconds() - lowestLatencyIpAddress = table.IpAddress[i] - } - } + for i, _ := range table.IpAddress { + // Checks if the ping is the lowest and if the following node is acting as a proxy + //if table.IpAddress[i].Latency.Milliseconds() < lowestLatency && table.IpAddress[i].ProxyPort != "" { + if table.IpAddress[i].Latency.Milliseconds() < lowestLatency && table.IpAddress[i].NAT != "" { + // Filter based on nodes with proxy enabled + if domainName != "" && table.IpAddress[i].ProxyServer == "Yes" { + lowestLatency = table.IpAddress[i].Latency.Milliseconds() + lowestLatencyIpAddress = table.IpAddress[i] + continue + } + lowestLatency = table.IpAddress[i].Latency.Milliseconds() + lowestLatencyIpAddress = table.IpAddress[i] + } + } - // If there is an identified node - if lowestLatency != 10000000 { - serverPort, err := frp.GetFRPServerPort("http://" + lowestLatencyIpAddress.Ipv4 + ":" + lowestLatencyIpAddress.ServerPort) - if err != nil { - return "", "", err - } - // Create 3 second delay to allow FRP server to start - time.Sleep(1 * time.Second) - // Starts FRP as a client with - proxyPort, err := frp.StartFRPClientForServer(lowestLatencyIpAddress.Ipv4, serverPort, port, "") - if err != nil { - return "", "", err - } + // If there is an identified node + if lowestLatency != 10000000 { + serverPort, err := frp.GetFRPServerPort("http://" + lowestLatencyIpAddress.Ipv4 + ":" + lowestLatencyIpAddress.ServerPort) + if err != nil { + return "", "", err + } + // Create 3 second delay to allow FRP server to start + time.Sleep(1 * time.Second) + // Starts FRP as a client with + proxyPort, err := frp.StartFRPClientForServer(lowestLatencyIpAddress.Ipv4, serverPort, port, "") + if err != nil { + return "", "", err + } - // Doing the proxy mapping for the domain name - if domainName != "" { - SaveRegistration(domainName, lowestLatencyIpAddress.Ipv4+":"+proxyPort) - } + // Doing the proxy mapping for the domain name + if domainName != "" { + SaveRegistration(domainName, lowestLatencyIpAddress.Ipv4+":"+proxyPort) + } - // updating with the current proxy address - ProxyIpAddr.Ipv4 = lowestLatencyIpAddress.Ipv4 - ProxyIpAddr.ServerPort = proxyPort - ProxyIpAddr.Name = config.MachineName - ProxyIpAddr.NAT = "False" - ProxyIpAddr.EscapeImplementation = "FRP" - //ProxyIpAddr.CustomInformationKey = p2p.GenerateHashSHA256(config.IPTableKey) - } else { - return "", "", errors.New("proxy IP not found") - } + // updating with the current proxy address + ProxyIpAddr.Ipv4 = lowestLatencyIpAddress.Ipv4 + ProxyIpAddr.ServerPort = proxyPort + ProxyIpAddr.Name = config.MachineName + ProxyIpAddr.NAT = "False" + ProxyIpAddr.EscapeImplementation = "FRP" + //ProxyIpAddr.CustomInformationKey = p2p.GenerateHashSHA256(config.IPTableKey) + } else { + return "", "", errors.New("proxy IP not found") + } - return ProxyIpAddr.Ipv4 + ":" + ProxyIpAddr.ServerPort, ProxyIpAddr.ServerPort, nil + return ProxyIpAddr.Ipv4 + ":" + ProxyIpAddr.ServerPort, ProxyIpAddr.ServerPort, nil } From a37f81a47f309ad16ae3d2f8452c1f1b257e2709 Mon Sep 17 00:00:00 2001 From: Akilan Date: Fri, 23 Aug 2024 02:24:54 +0100 Subject: [PATCH 05/18] added defaults for root node --- config/generate/generateFiles.go | 1 + 1 file changed, 1 insertion(+) diff --git a/config/generate/generateFiles.go b/config/generate/generateFiles.go index 78c58f7..c97c22b 100644 --- a/config/generate/generateFiles.go +++ b/config/generate/generateFiles.go @@ -47,6 +47,7 @@ func GenerateIPTableFile(rootNodes []p2p.IpAddress) (err error) { rootnode.ServerPort = "8078" rootnode.NAT = "False" rootnode.Ipv4 = "217.76.63.222" + rootnode.ProxyServer = "True" rootnodes.IpAddress = append(rootnodes.IpAddress, rootnode) } else { From 07dea4ff2729f4b41314720059741ea0a4aba798 Mon Sep 17 00:00:00 2001 From: Akilan Date: Fri, 23 Aug 2024 03:22:51 +0100 Subject: [PATCH 06/18] bumped up go version in mod file and added automatic generation of pem certificates --- .gitignore | 3 + config/config.go | 2 + config/generate/generate.go | 9 + config/generate/generateCertificate.go | 177 +++++++++++++++ go.mod | 92 +++++++- go.sum | 292 +------------------------ server/ReverseProxy.go | 133 +++++------ 7 files changed, 349 insertions(+), 359 deletions(-) create mode 100644 config/generate/generateCertificate.go diff --git a/.gitignore b/.gitignore index 1f8f00a..8f34978 100644 --- a/.gitignore +++ b/.gitignore @@ -38,3 +38,6 @@ test* # Ignore public and private keys p2prc.publicKey p2prc.privateKey + +# Ignore pem files +*.pem diff --git a/config/config.go b/config/config.go index 947e4e7..163a597 100644 --- a/config/config.go +++ b/config/config.go @@ -34,6 +34,8 @@ type Config struct { IPTableKey string PublicKeyFile string PrivateKeyFile string + PemFile string + KeyFile string BareMetal string CustomConfig interface{} //NetworkInterface string diff --git a/config/generate/generate.go b/config/generate/generate.go index 26b07ac..cdccc37 100644 --- a/config/generate/generate.go +++ b/config/generate/generate.go @@ -95,6 +95,15 @@ func SetDefaults(envName string, forceDefault bool, CustomConfig interface{}, No Defaults.PrivateKeyFile = defaultPath + "p2prc.privateKey" Defaults.BareMetal = "False" + // Generate certificate files for SSL + err = GenerateCertificate() + if err != nil { + return nil, err + } + + Defaults.PemFile = defaultPath + "cert.pem" + Defaults.KeyFile = defaultPath + "key.pem" + PrivateKeyExists, err := FileExists(Defaults.PrivateKeyFile) if err != nil { return nil, err diff --git a/config/generate/generateCertificate.go b/config/generate/generateCertificate.go new file mode 100644 index 0000000..3031777 --- /dev/null +++ b/config/generate/generateCertificate.go @@ -0,0 +1,177 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file.x + +// Generate a self-signed X.509 certificate for a TLS server. Outputs to +// 'cert.pem' and 'key.pem' and will overwrite existing files. + +package generate + +import ( + "crypto/ecdsa" + "crypto/ed25519" + "crypto/elliptic" + "crypto/rand" + "crypto/rsa" + "crypto/x509" + "crypto/x509/pkix" + "encoding/pem" + "github.com/Akilan1999/p2p-rendering-computation/p2p" + "log" + "math/big" + "net" + "os" + "strings" + "time" +) + +var ( + host = "" + validFrom = "" + validFor = 365 * 24 * time.Hour + isCA = false + rsaBits = 2048 + ecdsaCurve = "" + ed25519Key = false +) + +func publicKey(priv any) any { + switch k := priv.(type) { + case *rsa.PrivateKey: + return &k.PublicKey + case *ecdsa.PrivateKey: + return &k.PublicKey + case ed25519.PrivateKey: + return k.Public().(ed25519.PublicKey) + default: + return nil + } +} + +func GenerateCertificate() error { + var priv any + var err error + + //flag.Parse() + + host, err = p2p.CurrentPublicIP() + + if err != nil { + return err + } + + if len(host) == 0 { + log.Fatalf("Missing required --host parameter") + } + switch ecdsaCurve { + case "": + if ed25519Key { + _, priv, err = ed25519.GenerateKey(rand.Reader) + } else { + priv, err = rsa.GenerateKey(rand.Reader, rsaBits) + } + case "P224": + priv, err = ecdsa.GenerateKey(elliptic.P224(), rand.Reader) + case "P256": + priv, err = ecdsa.GenerateKey(elliptic.P256(), rand.Reader) + case "P384": + priv, err = ecdsa.GenerateKey(elliptic.P384(), rand.Reader) + case "P521": + priv, err = ecdsa.GenerateKey(elliptic.P521(), rand.Reader) + default: + log.Fatalf("Unrecognized elliptic curve: %q", ecdsaCurve) + } + if err != nil { + log.Fatalf("Failed to generate private key: %v", err) + } + + // ECDSA, ED25519 and RSA subject keys should have the DigitalSignature + // KeyUsage bits set in the x509.Certificate template + keyUsage := x509.KeyUsageDigitalSignature + // Only RSA subject keys should have the KeyEncipherment KeyUsage bits set. In + // the context of TLS this KeyUsage is particular to RSA key exchange and + // authentication. + if _, isRSA := priv.(*rsa.PrivateKey); isRSA { + keyUsage |= x509.KeyUsageKeyEncipherment + } + + var notBefore time.Time + if len(validFrom) == 0 { + notBefore = time.Now() + } else { + notBefore, err = time.Parse("Jan 2 15:04:05 2006", validFrom) + if err != nil { + log.Fatalf("Failed to parse creation date: %v", err) + } + } + + notAfter := notBefore.Add(validFor) + + serialNumberLimit := new(big.Int).Lsh(big.NewInt(1), 128) + serialNumber, err := rand.Int(rand.Reader, serialNumberLimit) + if err != nil { + log.Fatalf("Failed to generate serial number: %v", err) + } + + template := x509.Certificate{ + SerialNumber: serialNumber, + Subject: pkix.Name{ + Organization: []string{"Acme Co"}, + }, + NotBefore: notBefore, + NotAfter: notAfter, + + KeyUsage: keyUsage, + ExtKeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageServerAuth}, + BasicConstraintsValid: true, + } + + hosts := strings.Split(host, ",") + for _, h := range hosts { + if ip := net.ParseIP(h); ip != nil { + template.IPAddresses = append(template.IPAddresses, ip) + } else { + template.DNSNames = append(template.DNSNames, h) + } + } + + if isCA { + template.IsCA = true + template.KeyUsage |= x509.KeyUsageCertSign + } + + derBytes, err := x509.CreateCertificate(rand.Reader, &template, &template, publicKey(priv), priv) + if err != nil { + log.Fatalf("Failed to create certificate: %v", err) + } + + certOut, err := os.Create("cert.pem") + if err != nil { + log.Fatalf("Failed to open cert.pem for writing: %v", err) + } + if err := pem.Encode(certOut, &pem.Block{Type: "CERTIFICATE", Bytes: derBytes}); err != nil { + log.Fatalf("Failed to write data to cert.pem: %v", err) + } + if err := certOut.Close(); err != nil { + log.Fatalf("Error closing cert.pem: %v", err) + } + log.Print("wrote cert.pem\n") + + keyOut, err := os.OpenFile("key.pem", os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0600) + if err != nil { + log.Fatalf("Failed to open key.pem for writing: %v", err) + } + privBytes, err := x509.MarshalPKCS8PrivateKey(priv) + if err != nil { + log.Fatalf("Unable to marshal private key: %v", err) + } + if err := pem.Encode(keyOut, &pem.Block{Type: "PRIVATE KEY", Bytes: privBytes}); err != nil { + log.Fatalf("Failed to write data to key.pem: %v", err) + } + if err := keyOut.Close(); err != nil { + log.Fatalf("Error closing key.pem: %v", err) + } + log.Print("wrote key.pem\n") + + return nil +} diff --git a/go.mod b/go.mod index ed76f2f..3b589d3 100644 --- a/go.mod +++ b/go.mod @@ -1,27 +1,105 @@ module github.com/Akilan1999/p2p-rendering-computation -go 1.15 +go 1.18 require ( - github.com/Microsoft/go-winio v0.4.17-0.20210211115548-6eac466e5fa3 // indirect github.com/apenella/go-ansible v1.1.0 - github.com/containerd/containerd v1.5.0-beta.1 // indirect github.com/docker/docker v20.10.0-beta1.0.20201113105859-b6bfff2a628f+incompatible - github.com/docker/go-connections v0.4.0 // indirect github.com/fatedier/frp v0.45.0 github.com/gin-gonic/gin v1.6.3 github.com/go-git/go-git/v5 v5.4.2 github.com/google/uuid v1.3.0 github.com/lithammer/shortuuid v3.0.0+incompatible - github.com/moby/term v0.0.0-20201110203204-bea5bbe245bf // indirect - github.com/morikuni/aec v1.0.0 // indirect github.com/otiai10/copy v1.6.0 github.com/phayes/freeport v0.0.0-20180830031419-95f893ade6f2 github.com/shirou/gopsutil/v3 v3.22.10 github.com/urfave/cli/v2 v2.3.0 - gitlab.com/NebulousLabs/fastrand v0.0.0-20181126182046-603482d69e40 // indirect gitlab.com/NebulousLabs/go-upnp v0.0.0-20181011194642-3a71999ed0d3 golang.org/x/crypto v0.16.0 gopkg.in/yaml.v2 v2.4.0 +) + +require ( + github.com/Azure/go-ntlmssp v0.0.0-20200615164410-66371956d46c // indirect + github.com/Microsoft/go-winio v0.4.17-0.20210211115548-6eac466e5fa3 // indirect + github.com/ProtonMail/go-crypto v0.0.0-20210428141323-04723f9f07d7 // indirect + github.com/acomagu/bufpipe v1.0.3 // indirect + github.com/apenella/go-common-utils v0.1.1 // indirect + github.com/apenella/go-common-utils/error v0.0.0-20200917063805-34b0ed3c4ce1 // indirect + github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 // indirect + github.com/beorn7/perks v1.0.1 // indirect + github.com/cespare/xxhash/v2 v2.1.2 // indirect + github.com/containerd/containerd v1.5.0-beta.1 // indirect + github.com/coreos/go-oidc v2.2.1+incompatible // indirect + github.com/cpuguy83/go-md2man/v2 v2.0.0 // indirect + github.com/docker/distribution v2.7.1+incompatible // indirect + github.com/docker/go-connections v0.4.0 // indirect + github.com/docker/go-units v0.4.0 // indirect + github.com/emirpasic/gods v1.12.0 // indirect + github.com/fatedier/beego v0.0.0-20171024143340-6c6a4f5bd5eb // indirect + github.com/fatedier/golib v0.1.1-0.20220321042308-c306138b83ac // indirect + github.com/fatedier/kcp-go v2.0.4-0.20190803094908-fe8645b0a904+incompatible // indirect + github.com/gin-contrib/sse v0.1.0 // indirect + github.com/go-git/gcfg v1.5.0 // indirect + github.com/go-git/go-billy/v5 v5.3.1 // indirect + github.com/go-ole/go-ole v1.2.6 // indirect + github.com/go-playground/locales v0.14.0 // indirect + github.com/go-playground/universal-translator v0.18.0 // indirect + github.com/go-playground/validator/v10 v10.11.0 // indirect + github.com/gogo/protobuf v1.3.2 // indirect + github.com/golang/protobuf v1.5.2 // indirect + github.com/golang/snappy v0.0.1 // indirect + github.com/gorilla/mux v1.8.0 // indirect + github.com/hashicorp/yamux v0.1.1 // indirect + github.com/imdario/mergo v0.3.12 // indirect + github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect + github.com/json-iterator/go v1.1.12 // indirect + github.com/kevinburke/ssh_config v0.0.0-20201106050909-4977a11b4351 // indirect + github.com/klauspost/cpuid/v2 v2.0.6 // indirect + github.com/klauspost/reedsolomon v1.9.15 // indirect + github.com/leodido/go-urn v1.2.1 // indirect + github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 // indirect + github.com/mattn/go-isatty v0.0.12 // indirect + github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect + github.com/mitchellh/go-homedir v1.1.0 // indirect + github.com/moby/term v0.0.0-20201110203204-bea5bbe245bf // indirect + github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect + github.com/modern-go/reflect2 v1.0.2 // indirect + github.com/morikuni/aec v1.0.0 // indirect + github.com/opencontainers/go-digest v1.0.0 // indirect + github.com/opencontainers/image-spec v1.0.1 // indirect + github.com/pires/go-proxyproto v0.6.2 // indirect + github.com/pkg/errors v0.9.1 // indirect + github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c // indirect + github.com/pquerna/cachecontrol v0.0.0-20180517163645-1555304b9b35 // indirect + github.com/prometheus/client_golang v1.13.0 // indirect + github.com/prometheus/client_model v0.2.0 // indirect + github.com/prometheus/common v0.37.0 // indirect + github.com/prometheus/procfs v0.8.0 // indirect + github.com/russross/blackfriday/v2 v2.0.1 // indirect + github.com/sergi/go-diff v1.1.0 // indirect + github.com/shurcooL/sanitized_anchor_name v1.0.0 // indirect + github.com/sirupsen/logrus v1.7.0 // indirect + github.com/templexxx/cpufeat v0.0.0-20180724012125-cef66df7f161 // indirect + github.com/templexxx/xor v0.0.0-20191217153810-f85b25db303b // indirect + github.com/tjfoc/gmsm v1.4.1 // indirect + github.com/tklauser/go-sysconf v0.3.10 // indirect + github.com/tklauser/numcpus v0.4.0 // indirect + github.com/ugorji/go/codec v1.1.7 // indirect + github.com/xanzy/ssh-agent v0.3.0 // indirect + github.com/yusufpapurcu/wmi v1.2.2 // indirect + gitlab.com/NebulousLabs/fastrand v0.0.0-20181126182046-603482d69e40 // indirect + golang.org/x/net v0.10.0 // indirect + golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b // indirect + golang.org/x/sys v0.15.0 // indirect + golang.org/x/text v0.14.0 // indirect + golang.org/x/time v0.0.0-20220210224613-90d013bbcef8 // indirect + google.golang.org/appengine v1.6.7 // indirect + google.golang.org/genproto v0.0.0-20201110150050-8816d57aaa9a // indirect + google.golang.org/grpc v1.31.0 // indirect + google.golang.org/protobuf v1.28.1 // indirect + gopkg.in/ini.v1 v1.67.0 // indirect + gopkg.in/square/go-jose.v2 v2.4.1 // indirect + gopkg.in/warnings.v0 v0.1.2 // indirect gotest.tools/v3 v3.0.3 // indirect ) diff --git a/go.sum b/go.sum index 4052cb0..530db0d 100644 --- a/go.sum +++ b/go.sum @@ -14,18 +14,6 @@ cloud.google.com/go v0.56.0/go.mod h1:jr7tqZxxKOVYizybht9+26Z/gUq7tiRzu+ACVAMbKV cloud.google.com/go v0.57.0/go.mod h1:oXiQ6Rzq3RAkkY7N6t3TcE6jE+CIBBbA36lwQ1JyzZs= cloud.google.com/go v0.62.0/go.mod h1:jmCYTdRCQuc1PHIIJ/maLInMho30T/Y0M4hTdTShOYc= cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHObY= -cloud.google.com/go v0.72.0/go.mod h1:M+5Vjvlc2wnp6tjzE102Dw08nGShTscUx2nZMufOKPI= -cloud.google.com/go v0.74.0/go.mod h1:VV1xSbzvo+9QJOxLDaJfTjx5e+MePCpCWwvftOeQmWk= -cloud.google.com/go v0.78.0/go.mod h1:QjdrLG0uq+YwhjoVOLsS1t7TW8fs36kLs4XO5R5ECHg= -cloud.google.com/go v0.79.0/go.mod h1:3bzgcEeQlzbuEAYu4mrWhKqWjmpprinYgKJLgKHnbb8= -cloud.google.com/go v0.81.0/go.mod h1:mk/AM35KwGk/Nm2YSeZbxXdrNK3KZOYHmLkOqC2V6E0= -cloud.google.com/go v0.83.0/go.mod h1:Z7MJUsANfY0pYPdw0lbnivPx4/vhy/e2FEkSkF7vAVY= -cloud.google.com/go v0.84.0/go.mod h1:RazrYuxIK6Kb7YrzzhPoLmCVzl7Sup4NrbKPg8KHSUM= -cloud.google.com/go v0.87.0/go.mod h1:TpDYlFy7vuLzZMMZ+B6iRiELaY7z/gJPaqbMx6mlWcY= -cloud.google.com/go v0.90.0/go.mod h1:kRX0mNRHe0e2rC6oNakvwQqzyDmg57xJ+SZU1eT2aDQ= -cloud.google.com/go v0.93.3/go.mod h1:8utlLll2EF5XMAV15woO4lSbWQlk8rer9aLOfLh7+YI= -cloud.google.com/go v0.94.1/go.mod h1:qAlAugsXlC+JWO+Bke5vCtc9ONxjQT3drlTTnAplMW4= -cloud.google.com/go v0.97.0/go.mod h1:GF7l59pYBVlXQIBLx3a761cZ41F9bBH3JUlihCt2Udc= cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc= @@ -34,7 +22,6 @@ cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4g cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ= cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= -cloud.google.com/go/firestore v1.1.0/go.mod h1:ulACoGHTpvq5r8rxGJ4ddJZBZqakUQqClKRT5SZwBmk= cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw= cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA= @@ -51,17 +38,12 @@ github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78/go.mod h1:LmzpDX github.com/Azure/go-autorest v10.8.1+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSWATqVooLgysK6ZNox3g/xq24= github.com/Azure/go-autorest v14.2.0+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSWATqVooLgysK6ZNox3g/xq24= github.com/Azure/go-autorest/autorest v0.11.1/go.mod h1:JFgpikqFJ/MleTTxwepExTKnFUKKszPS8UavbQYUMuw= -github.com/Azure/go-autorest/autorest v0.11.27/go.mod h1:7l8ybrIdUmGqZMTD0sRtAr8NvbHjfofbf8RSP2q7w7U= github.com/Azure/go-autorest/autorest/adal v0.9.0/go.mod h1:/c022QCutn2P7uY+/oQWWNcK9YU+MH96NgK+jErpbcg= github.com/Azure/go-autorest/autorest/adal v0.9.5/go.mod h1:B7KF7jKIeC9Mct5spmyCB/A8CG/sEz1vwIRGv/bbw7A= -github.com/Azure/go-autorest/autorest/adal v0.9.18/go.mod h1:XVVeme+LZwABT8K5Lc3hA4nAe8LDBVle26gTrguhhPQ= -github.com/Azure/go-autorest/autorest/adal v0.9.20/go.mod h1:XVVeme+LZwABT8K5Lc3hA4nAe8LDBVle26gTrguhhPQ= github.com/Azure/go-autorest/autorest/date v0.3.0/go.mod h1:BI0uouVdmngYNUzGWeSYnokU+TrmwEsOqdt8Y6sso74= github.com/Azure/go-autorest/autorest/mocks v0.4.0/go.mod h1:LTp+uSrOhSkaKrUy935gNZuuIPPVsHlr9DSOxSayd+k= github.com/Azure/go-autorest/autorest/mocks v0.4.1/go.mod h1:LTp+uSrOhSkaKrUy935gNZuuIPPVsHlr9DSOxSayd+k= -github.com/Azure/go-autorest/autorest/mocks v0.4.2/go.mod h1:Vy7OitM9Kei0i1Oj+LvyAWMXJHeKH1MVlzFugfVrmyU= github.com/Azure/go-autorest/logger v0.2.0/go.mod h1:T9E3cAhj2VqvPOtCYAvby9aBXkZmbF5NWuPV8+WeEW8= -github.com/Azure/go-autorest/logger v0.2.1/go.mod h1:T9E3cAhj2VqvPOtCYAvby9aBXkZmbF5NWuPV8+WeEW8= github.com/Azure/go-autorest/tracing v0.6.0/go.mod h1:+vhtPC754Xsa23ID7GlGsrdKBpUA79WCAKPPZVC2DeU= github.com/Azure/go-ntlmssp v0.0.0-20200615164410-66371956d46c h1:/IBSNwUN8+eKzUzbJPqhK839ygXJ82sde8x3ogr6R28= github.com/Azure/go-ntlmssp v0.0.0-20200615164410-66371956d46c/go.mod h1:chxPXzSsl7ZWRAuOIE23GDNzjWuZquvFlgA8xmpunjU= @@ -97,17 +79,13 @@ github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk5 github.com/alexflint/go-filemutex v0.0.0-20171022225611-72bdc8eae2ae/go.mod h1:CgnQgUtFrFz9mxFNtED3jI5tLDjKlOM+oUF/sTk6ps0= github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239 h1:kFOfPq6dUM1hTo4JG6LR5AXSUEsOjtdm0kw0FtQtMJA= github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYUyUczH0OGQWaF5ceTx0UBShxjsH6f8oGKYe2c= -github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= github.com/apenella/go-ansible v1.1.0 h1:wWqaZBvoDxPjvtwXc2fXbDj546uBj/Kv2PL7PW82EfY= github.com/apenella/go-ansible v1.1.0/go.mod h1:tHqFBSwWXF9k2hkLQWfq6oxMQZHslySQqttkA2siyqE= github.com/apenella/go-common-utils v0.1.1 h1:dJA2tY22z6mYB5a+EogfiS7NxZsR/Ld3TWnZcS3JPa0= github.com/apenella/go-common-utils v0.1.1/go.mod h1:E7RUbl9B1vdLkTIapoTE2W6pIgW7dTSJOxL3pf4gV6g= github.com/apenella/go-common-utils/error v0.0.0-20200917063805-34b0ed3c4ce1 h1:lw/fwF65AaJVxyUTJShtBiZfaiafKde3QkR4im1glzQ= github.com/apenella/go-common-utils/error v0.0.0-20200917063805-34b0ed3c4ce1/go.mod h1:Hj3S/BcSHKfv9VDMcrY7lsm9hGnb7cd70alSkl/Sv+4= -github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= -github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= -github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio= github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs= github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY= @@ -119,7 +97,6 @@ github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= github.com/bitly/go-simplejson v0.5.0/go.mod h1:cXHtHw4XUPsvGaxgjIAn8PhEWG9NfngEKAMDJEczWVA= -github.com/bketelsen/crypt v0.0.3-0.20200106085610-5cbc8cc4026c/go.mod h1:MKsuJmJgSg28kpZDP6UIiPt0e0Oz0kqKNGyRaWEPv84= github.com/blang/semver v3.1.0+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk= github.com/blang/semver v3.5.1+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk= github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869/go.mod h1:Ekp36dRnpXw/yCqJaO+ZrUyxD+3VXMFFr56k5XYrpB4= @@ -129,7 +106,6 @@ github.com/bugsnag/bugsnag-go v0.0.0-20141110184014-b1d153021fcd/go.mod h1:2oa8n github.com/bugsnag/osext v0.0.0-20130617224835-0dd3f918b21b/go.mod h1:obH5gd0BsqsP2LwDJ9aOkm/6J86V6lyAXCoQWGw3K50= github.com/bugsnag/panicwrap v0.0.0-20151223152923-e2c28503fcd0/go.mod h1:D/8v3kj0zr8ZAKg1AQ6crr+5VwKN5eIywRkfhyM/+dE= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= -github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cespare/xxhash/v2 v2.1.2 h1:YRXhKfTDauu4ajMg1TPgFO5jnlC2HCbmLXMcTG5cbYE= @@ -143,9 +119,6 @@ github.com/cilium/ebpf v0.0.0-20200702112145-1c8d4c9ef775/go.mod h1:7cR51M8ViRLI github.com/cilium/ebpf v0.2.0/go.mod h1:To2CFviqOWL/M0gIMsvSMlqe7em/l1ALkX1PyjrX2Qs= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= -github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= -github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= -github.com/cncf/xds/go v0.0.0-20210312221358-fbca930ec8ed/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:zn76sxSg3SzpJ0PPJaLDCu+Bu0Lg3sKTORVIj19EIF8= github.com/containerd/aufs v0.0.0-20200908144142-dab0cbea06f4/go.mod h1:nukgQABAEopAHvB6j7cnP5zJ+/3aVcE7hCYqvIwAHyE= github.com/containerd/btrfs v0.0.0-20201111183144-404b9149801e/go.mod h1:jg2QkJcsabfHugurUvvPhS3E08Oxiuh5W/g1ybB4e0E= @@ -196,7 +169,6 @@ github.com/containernetworking/plugins v0.8.6/go.mod h1:qnw5mN19D8fIwkqW7oHHYDHV github.com/containers/ocicrypt v1.0.1/go.mod h1:MeJDzk1RJHv89LjsH0Sp5KTY3ZYkjXO/C+bKAeWFIrc= github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= -github.com/coreos/etcd v3.3.13+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= github.com/coreos/go-iptables v0.4.5/go.mod h1:/mVI274lEDI2ns62jHCDnCyBF9Iwsmekav8Dbxlm1MU= github.com/coreos/go-oidc v2.1.0+incompatible/go.mod h1:CgnwVTmzoESiwO9qyAFEMiHoZ1nMCKZlZ9V6mm3/LKc= github.com/coreos/go-oidc v2.2.1+incompatible h1:mh48q/BqXqgjVHpy2ZY7WnWAbenxRjsz9N1i1YxjHAk= @@ -215,7 +187,6 @@ github.com/cpuguy83/go-md2man/v2 v2.0.0 h1:EoUDS0afbrsXAZ9YQ9jdu/mZ2sXgT1/2yyNng github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= -github.com/creack/pty v1.1.11 h1:07n33Z8lZxZ2qwegKbObQohDhXDQxiMMz1NOUGYlesw= github.com/creack/pty v1.1.11/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/cyphar/filepath-securejoin v0.2.2/go.mod h1:FpkQEhXnPnOthhzymB7CGsFk2G9VLXONKD9G7QGMM+4= github.com/d2g/dhcp4 v0.0.0-20170904100407-a1d1b6c41b1c/go.mod h1:Ct2BUK8SB0YC1SMSibvLzxjeJLnrYEVLULFNiHY9YfQ= @@ -252,19 +223,13 @@ github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25Kn github.com/elazarl/goproxy v0.0.0-20180725130230-947c36da3153/go.mod h1:/Zj4wYkgs4iZTTu3o/KG3Itv/qCCa8VVMlb3i9OVuzc= github.com/emicklei/go-restful v0.0.0-20170410110728-ff4f55a20633/go.mod h1:otzb+WCGbkyDHkqmQmT5YD2WR4BBwUdeQoFo8l/7tVs= github.com/emicklei/go-restful v2.9.5+incompatible/go.mod h1:otzb+WCGbkyDHkqmQmT5YD2WR4BBwUdeQoFo8l/7tVs= -github.com/emicklei/go-restful/v3 v3.8.0/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc= github.com/emirpasic/gods v1.12.0 h1:QAUIPSaCu4G+POclxeqb3F+WPpdKqFGlw36+yOzGlrg= github.com/emirpasic/gods v1.12.0/go.mod h1:YfzfFFoVP/catgzJb4IKIqXjX78Ha8FMSDh3ymbK86o= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= -github.com/envoyproxy/go-control-plane v0.9.7/go.mod h1:cwu0lG7PUMfa9snN8LXBig5ynNVH9qI8YYLbd1fK2po= -github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= -github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= -github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.mod h1:hliV/p42l8fGbc6Y9bQ70uLwIvmJyVE5k4iMKlh8wCQ= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/evanphx/json-patch v4.9.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= -github.com/evanphx/json-patch v4.12.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= github.com/fatedier/beego v0.0.0-20171024143340-6c6a4f5bd5eb h1:wCrNShQidLmvVWn/0PikGmpdP0vtQmnvyRg3ZBEhczw= github.com/fatedier/beego v0.0.0-20171024143340-6c6a4f5bd5eb/go.mod h1:wx3gB6dbIfBRcucp94PI9Bt3I0F2c/MyNEWuhzpWiwk= github.com/fatedier/frp v0.45.0 h1:QH3P4DFsHInsLWMT2vCiGZg5MrdJ5TDcVmarcol7u6A= @@ -275,14 +240,12 @@ github.com/fatedier/kcp-go v2.0.4-0.20190803094908-fe8645b0a904+incompatible h1: github.com/fatedier/kcp-go v2.0.4-0.20190803094908-fe8645b0a904+incompatible/go.mod h1:YpCOaxj7vvMThhIQ9AfTOPW2sfztQR5WDfs7AflSy4s= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fatih/color v1.10.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM= -github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568 h1:BHsljHzVlRcyQhjrss6TZTdY2VfCqZPbv5k3iBFa2ZQ= github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc= github.com/form3tech-oss/jwt-go v3.2.2+incompatible/go.mod h1:pbq4aXjuKjdthFRnoDwaVPLA+WlJuPGy+QneDUgJi2k= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/fullsailor/pkcs7 v0.0.0-20190404230743-d7302db945fa/go.mod h1:KnogPXtdwXqoenmZCw6S+25EAm2MkxbG0deNDu4cbSA= github.com/garyburd/redigo v0.0.0-20150301180006-535138d7bcd7/go.mod h1:NR3MbYisc3/PwhQ00EMzDiPmrwpPxAn5GI05/YaO1SY= -github.com/getkin/kin-openapi v0.76.0/go.mod h1:660oXbgy5JFMKreazJaQTw7o+X00qeSyhcnluiMv+Xg= github.com/ghodss/yaml v0.0.0-20150909031657-73d445a93680/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE= @@ -314,20 +277,15 @@ github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG github.com/go-logfmt/logfmt v0.5.1/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs= github.com/go-logr/logr v0.1.0/go.mod h1:ixOQHD9gLJUVQQ2ZOR7zLEifBX6tGkNJF4QyIY7sIas= github.com/go-logr/logr v0.2.0/go.mod h1:z6/tIYblkpsD+a4lm/fGIIU9mZ+XfAiaFtq7xTgseGU= -github.com/go-logr/logr v1.2.0/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY= github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= github.com/go-openapi/jsonpointer v0.19.2/go.mod h1:3akKfEdA7DF1sugOqz1dVQHBcuDBPKZGEoHC/NkiQRg= github.com/go-openapi/jsonpointer v0.19.3/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= -github.com/go-openapi/jsonpointer v0.19.5/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= github.com/go-openapi/jsonreference v0.19.2/go.mod h1:jMjeRr2HHw6nAVajTXJ4eiUwohSTlpa0o73RUL1owJc= github.com/go-openapi/jsonreference v0.19.3/go.mod h1:rjx6GuL8TTa9VaixXglHmQmIL98+wF9xc8zWvFonSJ8= -github.com/go-openapi/jsonreference v0.19.5/go.mod h1:RdybgQwPxbL4UEjuAruzK1x3nE69AqPYEJeo/TWfEeg= github.com/go-openapi/spec v0.19.3/go.mod h1:FpwSN1ksY1eteniUU7X0N/BgJ7a4WvBFVA8Lj9mJglo= github.com/go-openapi/swag v0.19.2/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= -github.com/go-openapi/swag v0.19.14/go.mod h1:QYRuS/SOXUCsnplDa677K7+DxSOj6IPNl/eQntq43wQ= github.com/go-playground/assert/v2 v2.0.1 h1:MsBgLAaY856+nPRTKrp3/OZK38U/wa0CcBYNjji3q3A= github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8= @@ -340,7 +298,6 @@ github.com/go-playground/validator/v10 v10.2.0/go.mod h1:uOYAAleCW8F/7oMFd6aG0GO github.com/go-playground/validator/v10 v10.11.0 h1:0W+xRM511GY47Yy3bZUbJVitCNg2BOGlCyvTqsp/xIw= github.com/go-playground/validator/v10 v10.11.0/go.mod h1:i+3WkQ1FvaUjjxh1kSvIA4dMGDBiPU55YFDl0WbKdWU= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= -github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= github.com/godbus/dbus v0.0.0-20151105175453-c7fdd8b5cd55/go.mod h1:/YcGZj5zSblfDWMMoOzV4fas9FZnQYTkDnsGvmh2Grw= github.com/godbus/dbus v0.0.0-20180201030542-885f9cc04c9c/go.mod h1:/YcGZj5zSblfDWMMoOzV4fas9FZnQYTkDnsGvmh2Grw= github.com/godbus/dbus v0.0.0-20190422162347-ade71ed3457e/go.mod h1:bBOAhwG1umN6/6ZUMtDFBMQR8jRg9O75tm9K00oMsK4= @@ -354,15 +311,12 @@ github.com/gogo/protobuf v1.3.0/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXP github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= -github.com/golang-jwt/jwt/v4 v4.0.0/go.mod h1:/xlHOz8bRuivTWchD4jCa+NbatV+wEUSzwAxVc6locg= -github.com/golang-jwt/jwt/v4 v4.2.0/go.mod h1:/xlHOz8bRuivTWchD4jCa+NbatV+wEUSzwAxVc6locg= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= @@ -370,8 +324,6 @@ github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4= -github.com/golang/mock v1.5.0/go.mod h1:CWnOUgYIOo4TcNZ0wHX3YZCqsaM1I1Jvs6v3mP3KVu8= -github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= @@ -387,16 +339,12 @@ github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QD github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -github.com/golang/protobuf v1.5.1/go.mod h1:DopwsBzvsk0Fs44TXzsVbJyPhcCPeIwnvohx4u74HPM= github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/golang/snappy v0.0.1 h1:Qgr9rKW7uDUkrbSmQeiDsGa8SjGyCOGtuasMWwvp2P4= github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/golang/snappy v0.0.3 h1:fHPg5GQYlCeLIPB9BZqMVR5nR9A+IM5zcgeTdjMYmLA= -github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= -github.com/google/btree v1.0.1/go.mod h1:xXMiIv4Fb/0kKde4SpL7qlzvu5cMJDRkFDxJfI9uaxA= -github.com/google/gnostic v0.5.7-v3refs/go.mod h1:73MKFl6jIHelAJNaBGFzt3SPtZULs9dYrGFt8OiIsHQ= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= @@ -405,19 +353,15 @@ github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/gofuzz v1.1.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= -github.com/google/martian/v3 v3.1.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= -github.com/google/martian/v3 v3.2.1/go.mod h1:oBOf6HBosgwRXnUGWUB05QECsc6uvmMiJ3+6W4l/CUk= github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= github.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= @@ -425,14 +369,6 @@ github.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hf github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20201023163331-3e6fc7fc9c4c/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/pprof v0.0.0-20201203190320-1bf35d6f28c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/pprof v0.0.0-20210122040257-d980be63207e/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/pprof v0.0.0-20210226084205-cbba55b83ad5/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/pprof v0.0.0-20210601050228-01bbb1931b22/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/pprof v0.0.0-20210609004039-a478d1d731e9/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= @@ -441,7 +377,6 @@ github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= -github.com/googleapis/gax-go/v2 v2.1.0/go.mod h1:Q3nei7sK6ybPYH7twZdmQpAd1MKb7pfu6SK+H1/DsU0= github.com/googleapis/gnostic v0.4.1/go.mod h1:LRhVm6pbyptWbWbuZ38d1eyptfvIytN3ir6b65WBswg= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gorilla/handlers v0.0.0-20150720190736-60c7bfde3e33/go.mod h1:Qkdc/uu4tH4g6mTK6auzZ766c4CA0Ng8+o/OAirnOIQ= @@ -451,43 +386,24 @@ github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB7 github.com/gorilla/websocket v0.0.0-20170926233335-4201258b820c/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= -github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA= github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= github.com/grpc-ecosystem/go-grpc-middleware v1.0.1-0.20190118093823-f849b5445de4/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= -github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= -github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q= -github.com/hashicorp/consul/sdk v0.1.1/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= github.com/hashicorp/errwrap v0.0.0-20141028054710-7554cd9344ce/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= -github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= -github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= -github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM= github.com/hashicorp/go-multierror v0.0.0-20161216184304-ed905158d874/go.mod h1:JMRHfdO9jKNzS/+BTlxCjKNQHg/jZAft8U7LloJvN7I= github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= -github.com/hashicorp/go-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU= -github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU= -github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4= -github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= -github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= -github.com/hashicorp/go.net v0.0.1/go.mod h1:hjKkEWcCURg++eb33jQU7oqQcI9XDCnUzHA0oac0k90= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= -github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= -github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ= -github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I= -github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= github.com/hashicorp/yamux v0.1.1 h1:yrQxtgseBDrq9Y652vSRDvsKCJKOUD+GzTS4Y0Y8pvE= github.com/hashicorp/yamux v0.1.1/go.mod h1:CtWFDAQgb7dxtzFs4tWbplKIe2jSi3+5vKbgIO0SLnQ= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= -github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/imdario/mergo v0.3.5/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= -github.com/imdario/mergo v0.3.6/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= github.com/imdario/mergo v0.3.8/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= github.com/imdario/mergo v0.3.10/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= github.com/imdario/mergo v0.3.12 h1:b6R2BslTbIEToALKP7LxUvijTsNI9TAe80pLWN2g/HU= @@ -500,7 +416,6 @@ github.com/jessevdk/go-flags v1.5.0/go.mod h1:Fw0T6WPc1dYxT4mKEZRfG5kJhaTDP9pj1c github.com/jmespath/go-jmespath v0.0.0-20160202185014-0b12d6b521d8/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= github.com/jmespath/go-jmespath v0.0.0-20160803190731-bd40a432e4c7/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= -github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= @@ -547,39 +462,27 @@ github.com/lithammer/shortuuid v3.0.0+incompatible/go.mod h1:FR74pbAuElzOUuenUHT github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 h1:6E+4a0GO5zZEnZ81pIr0yLvtUWk2if982qA3F3QD6H4= github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0/go.mod h1:zJYVVT2jmtg6P3p1VtQj7WsuWi/y4VnjVBn7F8KPB3I= github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= -github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= github.com/mailru/easyjson v0.7.0/go.mod h1:KAzv3t3aY1NaHWoQz1+4F1ccyAH66Jk7yos7ldAVICs= -github.com/mailru/easyjson v0.7.6/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= github.com/marstr/guid v1.1.0/go.mod h1:74gB1z2wpxxInTG6yaqA7KrtM0NZ+RbrcqDvYHefzho= github.com/matryer/is v1.2.0 h1:92UTHpy8CDwaJ08GqLDzhhuixiBUUD1p3AU6PHddz4A= github.com/matryer/is v1.2.0/go.mod h1:2fLPjFQM9rhQ15aVEtbuwhJinnOqrmgXPNdZsdwlWXA= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= -github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY= github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= -github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= github.com/mattn/go-shellwords v1.0.3/go.mod h1:3xCvwCdWdlDJUrvuMn7Wuy9eWs4pE8vqg+NOMyg4B2o= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 h1:I0XW9+e1XWDxdcEniV4rQAIOPUGDq67JSCiRCgGCZLI= github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= -github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= github.com/mistifyio/go-zfs v2.1.2-0.20190413222219-f784269be439+incompatible/go.mod h1:8AuVvqP/mXw1px98n46wfvcGfQ4ci2FwoAjKYxuo3Z4= -github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= -github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= -github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI= -github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS42BGNg= -github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY= -github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mitchellh/osext v0.0.0-20151018003038-5e2d6d41470f/go.mod h1:OkQIRizQZAeMln+1tSwduZz7+Af5oFlKirV/MSYes2A= -github.com/moby/spdystream v0.2.0/go.mod h1:f7i0iNDQJ059oMTcWxx8MA/zKFIuD/lY+0GqbN2Wy8c= github.com/moby/sys/mountinfo v0.4.0/go.mod h1:rEr8tzG/lsIZHBtN/JjGG+LMYx9eXgW2JI+6q0qou+A= github.com/moby/sys/symlink v0.1.0/go.mod h1:GGDODQmbFOjFsXvfLVn3+ZRxkch54RkSiGqsZeMYowQ= github.com/moby/term v0.0.0-20200312100748-672ec06f55cd/go.mod h1:DdlQx2hp0Ss5/fLikoLlEeIYiATotOjgB//nb973jeo= @@ -602,8 +505,6 @@ github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRW github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f/go.mod h1:ZdcZmHo+o7JKHSa8/e818NopupXU1YMK5fe1lsApnBw= github.com/ncw/swift v1.0.47/go.mod h1:23YIA4yWVnGwv2dQlN4bB7egfYX6YLn0Yo/S6zZO/ZM= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= -github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= -github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= github.com/olekukonko/tablewriter v0.0.0-20170122224234-a0225b3f23b5/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= github.com/onsi/ginkgo v0.0.0-20151202141238-7f8ab55aaf3b/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= @@ -612,20 +513,10 @@ github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+W github.com/onsi/ginkgo v1.10.1/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.10.3/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.11.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= -github.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vvnwo0= -github.com/onsi/ginkgo/v2 v2.1.3/go.mod h1:vw5CSIxN1JObi/U8gcbwft7ZxR2dgaR70JSE3/PpL4c= -github.com/onsi/ginkgo/v2 v2.1.4/go.mod h1:um6tUpWM/cxCK3/FK8BXqEiUMUwRgSM4JXG47RKZmLU= -github.com/onsi/ginkgo/v2 v2.1.6/go.mod h1:MEH45j8TBi6u9BMogfbp0stKC5cdGjumZj5Y7AG4VIk= github.com/onsi/gomega v0.0.0-20151007035656-2152b45fa28a/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA= github.com/onsi/gomega v0.0.0-20170829124025-dcabb60a477c/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA= github.com/onsi/gomega v1.7.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= -github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= -github.com/onsi/gomega v1.17.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAlGdZY= -github.com/onsi/gomega v1.19.0/go.mod h1:LY+I3pBVzYsTBU1AnDwOSxaYi9WoWiqgwooUqq9yPro= -github.com/onsi/gomega v1.20.1/go.mod h1:DtrZpjmvpn2mPm4YWQa0/ALMDj9v4YxLgojwPeREyVo= -github.com/onsi/gomega v1.20.2/go.mod h1:iYAIXgPSaDHak0LCMA+AWBpIKBr8WZicMxnE8luStNc= github.com/opencontainers/go-digest v0.0.0-20170106003457-a6d0ee40d420/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= github.com/opencontainers/go-digest v0.0.0-20180430190053-c9281466c8b2/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= github.com/opencontainers/go-digest v1.0.0-rc1/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= @@ -651,12 +542,10 @@ github.com/opencontainers/selinux v1.8.0/go.mod h1:RScLhm78qiWa2gbVCcGkC7tCGdgk3 github.com/otiai10/copy v1.6.0 h1:IinKAryFFuPONZ7cm6T6E2QX/vcJwSnlaA5lfoaXIiQ= github.com/otiai10/copy v1.6.0/go.mod h1:XWfuS3CrI0R6IE0FbgHsEazaXO8G0LpMp9o8tos0x4E= github.com/otiai10/curr v0.0.0-20150429015615-9b4961190c95/go.mod h1:9qAhocn7zKJG+0mI8eUu6xqkFDYS2kb2saOteoSB3cE= -github.com/otiai10/curr v1.0.0 h1:TJIWdbX0B+kpNagQrjgq8bCMrbhiuX73M2XwgtDMoOI= github.com/otiai10/curr v1.0.0/go.mod h1:LskTG5wDwr8Rs+nNQ+1LlxRjAtTZZjtJW4rMXl6j4vs= github.com/otiai10/mint v1.3.0/go.mod h1:F5AjcsTsWUqX+Na9fpHb52P8pcRX2CI6A3ctIT91xUo= github.com/otiai10/mint v1.3.2 h1:VYWnrP5fXmz1MXvjuUvcBrXSjGE6xjON+axB/UrpO3E= github.com/otiai10/mint v1.3.2/go.mod h1:/yxELlJQ0ufhjUwhshSj+wFjZ78CnZ48/1wtmBH1OTc= -github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= github.com/peterbourgon/diskv v2.0.1+incompatible/go.mod h1:uqqh8zWWbv1HBMNONnaR/tNboyR3/BZd58JJSHlUSCU= github.com/phayes/freeport v0.0.0-20180830031419-95f893ade6f2 h1:JhzVVoYvbOACxoUmOs6V/G4D5nPVUW73rKvXxP4XUJc= @@ -671,7 +560,6 @@ github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c h1:ncq/mPwQF4JjgDlrVEn3C11VoGHZN7m8qihwgMEtzYw= github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= github.com/pquerna/cachecontrol v0.0.0-20171018203845-0dec1b30a021/go.mod h1:prYjPmNq4d1NPVmpShWobRqXY3q7Vp+80DqgxxUrUIA= @@ -718,19 +606,15 @@ github.com/prometheus/procfs v0.7.3/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1 github.com/prometheus/procfs v0.8.0 h1:ODq8ZFEaYeCaZOJlZZdJA2AbQR98dSHSM1KW/You5mo= github.com/prometheus/procfs v0.8.0/go.mod h1:z7EfXMXOkbkqb9IINtpCn86r/to3BnA0uaxHdg830/4= github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= -github.com/rodaine/table v1.0.1/go.mod h1:UVEtfBsflpeEcD56nF4F5AocNFta0ZuolpSVdPtlmP4= github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= -github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= github.com/rogpeppe/go-internal v1.8.0 h1:FCbCCtXNOY3UtUuHUYaghJg4y7Fd14rXifAYUAtL9R8= github.com/rogpeppe/go-internal v1.8.0/go.mod h1:WmiCO8CzOY8rg0OYDC4/i/2WRWAB6poM+XZ2dLUbcbE= github.com/russross/blackfriday/v2 v2.0.1 h1:lPqVAte+HuHNfhJ/0LC98ESWRz8afy9tM/0RK8m9o+Q= github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= github.com/safchain/ethtool v0.0.0-20190326074333-42ed695e3de8/go.mod h1:Z0q5wiBQGYcxhMZ6gUqHn6pYNLypFAvaL3UvgZLR0U4= github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0= -github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= github.com/seccomp/libseccomp-golang v0.9.1/go.mod h1:GbW5+tmTXfcxTToHLXlScSlAvWlF4P2Ca7zGrPiEpWo= github.com/sergi/go-diff v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0= github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= @@ -748,7 +632,6 @@ github.com/sirupsen/logrus v1.7.0 h1:ShrD1U9pZB12TX0cVy0DtePoCH97K8EtX+mg7ZARUtM github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= github.com/smartystreets/goconvey v0.0.0-20190330032615-68dc04aab96a/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= -github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= @@ -757,7 +640,6 @@ github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkU github.com/spf13/cobra v0.0.2-0.20171109065643-2da4a54c5cee/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= github.com/spf13/cobra v1.0.0/go.mod h1:/6GTrnGXV9HjY+aR4k0oJ5tcvakLuG6EuKReYlHNrgE= -github.com/spf13/cobra v1.1.3/go.mod h1:pGADOWyqRD/YMrPZigI/zbliZ2wVD/23d+is3pSWzOo= github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= github.com/spf13/pflag v0.0.0-20170130214245-9ff6c6923cff/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/spf13/pflag v1.0.1-0.20171106142849-4c012f6dcd95/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= @@ -765,8 +647,6 @@ github.com/spf13/pflag v1.0.1/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnIn github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/viper v1.4.0/go.mod h1:PTJ7Z/lr49W6bUbkmS1V3by4uWynFiR9p7+dSq/yZzE= -github.com/spf13/viper v1.7.0/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg= -github.com/stoewer/go-strcase v1.2.0/go.mod h1:IBiWB2sKIp3wVVQ3Y035++gc+knqhUQag1KpM8ahLw8= github.com/stretchr/objx v0.0.0-20180129172003-8a3f7159479f/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= @@ -777,14 +657,12 @@ github.com/stretchr/testify v0.0.0-20180303142811-b89eecf5ca5d/go.mod h1:a8OnRci github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= github.com/syndtr/gocapability v0.0.0-20170704070218-db04d3cc01c8/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww= github.com/syndtr/gocapability v0.0.0-20180916011248-d98352740cb2/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww= github.com/syndtr/gocapability v0.0.0-20200815063812-42c35b437635/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww= @@ -802,14 +680,12 @@ github.com/tklauser/numcpus v0.4.0/go.mod h1:1+UI3pD8NW14VMwdgJNJ1ESk2UnwhAnz5hM github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= -github.com/ugorji/go v1.1.7 h1:/68gy2h+1mWMrwZFeD1kQialdSzAb432dtpeJ42ovdo= github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw= github.com/ugorji/go/codec v1.1.7 h1:2SvQaVZ1ouYrrKKwoSk2pzd4A9evlKJb9oTL+OaLUSs= github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY= github.com/urfave/cli v0.0.0-20171014202726-7bc6a0acffa5/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= -github.com/urfave/cli v1.22.2 h1:gsqYFH8bb9ekPA12kRo0hfjngWQjkJPlN9R0N78BoUo= github.com/urfave/cli v1.22.2/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= github.com/urfave/cli/v2 v2.3.0 h1:qph92Y649prgesehzOrQjdWyxFOp/QVM+6imKHad91M= github.com/urfave/cli/v2 v2.3.0/go.mod h1:LJmUH05zAU44vOAcrfzZQKsZbVcdbOG8rtL3/XcUArI= @@ -827,14 +703,10 @@ github.com/xeipuuv/gojsonschema v0.0.0-20180618132009-1d523034197f/go.mod h1:5yf github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= github.com/xtaci/lossyconn v0.0.0-20200209145036-adba10fffc37 h1:EWU6Pktpas0n8lLQwDsRyZfmkPeRbdgPtW609es+/9E= -github.com/xtaci/lossyconn v0.0.0-20200209145036-adba10fffc37/go.mod h1:HpMP7DB2CyokmAh4lp0EQnnWhmycP/TvwBGzvuie+H0= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= -github.com/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= -github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= github.com/yusufpapurcu/wmi v1.2.2 h1:KBNDSne4vP5mbSWnJbO+51IMOXJB67QiYCSBrubbPRg= github.com/yusufpapurcu/wmi v1.2.2/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0= github.com/yvasiyarov/go-metrics v0.0.0-20140926110328-57bccd1ccd43/go.mod h1:aX5oPXxHm3bOH+xeAttToC8pqch2ScQN/JoXYupl6xs= @@ -853,9 +725,6 @@ go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= -go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E= -go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= @@ -863,7 +732,6 @@ go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= golang.org/x/crypto v0.0.0-20171113213409-9f005a07e0d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20181009213950-7c1a557ab941/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190219172222-a4c6cb3142f2/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= @@ -876,9 +744,7 @@ golang.org/x/crypto v0.0.0-20201002170205-7f63de1d35b0/go.mod h1:LzIPMQfyMNhhGPh golang.org/x/crypto v0.0.0-20201012173705-84dcc777aaee/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= -golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20211215153901-e495a2d5b3d3/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/crypto v0.0.0-20220315160706-3147a52a75dd/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.16.0 h1:mMMrFzRSCF0GvB7Ne27XVtVAaXLrPmgPC7/v0tkwHaY= golang.org/x/crypto v0.16.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -903,8 +769,6 @@ golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHl golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs= golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= -golang.org/x/lint v0.0.0-20201208152925-83fdc39ff7b5/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= -golang.org/x/lint v0.0.0-20210508222113-6edffad5e616/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= @@ -913,19 +777,11 @@ golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzB golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3/go.mod h1:3p9vT2HGsQu2K1YbXdKPJLVgG5VJdoTa1poYQBtP1AY= -golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= -golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181011144130-49bb7cea24b1/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181023162649-9b4f9f5ad519/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -953,32 +809,20 @@ golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/ golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20201010224723-4f7140c49acb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20201031054903-ff519b6c9102/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20201209123823-ac852fbbde11/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20201224014010-6772e930b67b/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLdyRGr576XBO4/greRjx4P4O3yc= golang.org/x/net v0.0.0-20210326060303-6b1517762897/go.mod h1:uSPa2vr4CLtc/ILN5odXGNXS6mhrKVzTaCXzk9m6W3k= -golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= -golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk= -golang.org/x/net v0.0.0-20210503060351-7fd8e65b6420/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= @@ -986,17 +830,7 @@ golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4Iltr golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20200902213428-5d25da1a8d43/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20201109201403-9fd604954f58/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20201208152858-08078c50e5b5/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20210218202405-ba52d332ba99/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20210220000619-9bb904979d93/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20210313182246-cd4f82c27b84/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20210628180205-a41e5a781914/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20210805134026-6f1e6394065a/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20210819190943-2bc19b11175f/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b h1:clP8eMhB30EHdc0bd2Twtq6kgU7yl5ub2cQLSdrv1Dg= golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -1009,15 +843,9 @@ golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20220601150217-0de741cfad7f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -1037,7 +865,6 @@ golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190801041406-cbf593c0f2f3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190812073006-9eafafc0a87e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -1069,7 +896,6 @@ golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200728102440-3e129f6d46b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200831180312-196b9ba8737a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200905004654-be1d3432aa8f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200909081042-eff7692f9009/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200916030750-2334cc1a136f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200922070232-aee5d888a860/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -1079,57 +905,31 @@ golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201201145000-ef89a241ccb3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201202213521-69691e467435/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210104204734-6f8348627aad/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210220050731-9a76102bfb43/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210305230114-8fe3ee5dd75b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210324051608-47abb6519492/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210502180810-71e4cd670f79/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210514084401-e8d321eab015/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210603125802-9665404d3644/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210823070655-63515b42dcdf/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210908233432-aa78b53d3365/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220128215802-99c3d69c2c27/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220319134239-a9b59b0215f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220422013727-9388b58f7150/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= -golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= golang.org/x/term v0.15.0 h1:y/Oo/a/q3IXu26lQgl04j/gjuBDOBlx7X6Om1j2CPW4= -golang.org/x/term v0.15.0/go.mod h1:BDl952bC7+uMoWR75FIrCDx79TPU9oHkTZ9yRbYOrX0= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -1159,7 +959,6 @@ golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgw golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191112195655-aa38f8e97acc/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= @@ -1179,7 +978,6 @@ golang.org/x/tools v0.0.0-20200304193943-95d2e580d8eb/go.mod h1:o4KQGtdN14AW+yjs golang.org/x/tools v0.0.0-20200312045724-11d5b4c81c7d/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200505023115-26f46d2f7ef8/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= @@ -1187,22 +985,7 @@ golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roY golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= -golang.org/x/tools v0.0.0-20200904185747-39188db58858/go.mod h1:Cj7w3i3Rnn0Xh82ur9kSqwfTHTeVxaDqrfMjpcNT6bE= -golang.org/x/tools v0.0.0-20201110124207-079ba7bd75cd/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20201201161351-ac6f37ff4c2a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20201208233053-a543418bbed2/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= -golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.1.3/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.1.10/go.mod h1:Uh6Zz+xoGYZom868N8YTex3t7RhtHDBrE8Gzo9bV56E= -golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -1224,18 +1007,6 @@ google.golang.org/api v0.24.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0M google.golang.org/api v0.28.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= google.golang.org/api v0.29.0/go.mod h1:Lcubydp8VUV7KeIHD9z2Bys/sm/vGKnG1UHuDBSrHWM= google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz5138Fc= -google.golang.org/api v0.35.0/go.mod h1:/XrVsuzM0rZmrsbjJutiuftIzeuTQcEeaYcSk/mQ1dg= -google.golang.org/api v0.36.0/go.mod h1:+z5ficQTmoYpPn8LCUNVpK5I7hwkpjbcgqA7I34qYtE= -google.golang.org/api v0.40.0/go.mod h1:fYKFpnQN0DsDSKRVRcQSDQNtqWPfM9i+zNPxepjRCQ8= -google.golang.org/api v0.41.0/go.mod h1:RkxM5lITDfTzmyKFPt+wGrCJbVfniCr2ool8kTBzRTU= -google.golang.org/api v0.43.0/go.mod h1:nQsDGjRXMo4lvh5hP0TKqF244gqhGcr/YSIykhUk/94= -google.golang.org/api v0.47.0/go.mod h1:Wbvgpq1HddcWVtzsVLyfLp8lDg6AA241LmgIL59tHXo= -google.golang.org/api v0.48.0/go.mod h1:71Pr1vy+TAZRPkPs/xlCf5SsU8WjuAWv1Pfjbtukyy4= -google.golang.org/api v0.50.0/go.mod h1:4bNT5pAuq5ji4SRZm+5QIkjny9JAyVD/3gaSihNefaw= -google.golang.org/api v0.51.0/go.mod h1:t4HdrdoNgyN5cbEfm7Lum0lcLDLiise1F8qDKX00sOU= -google.golang.org/api v0.54.0/go.mod h1:7C4bFFOvVDGXjfDTAsgGwDgAxRDeQ4X8NvUedIt6z3k= -google.golang.org/api v0.55.0/go.mod h1:38yMfeP1kfjsl8isn0tliTjIb1rJXcQi4UXlbqivdVE= -google.golang.org/api v0.57.0/go.mod h1:dVPlbZyBo2/OjBpmvNdpn2GRm6rPy75jyU7bmhdrMgI= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= @@ -1270,41 +1041,14 @@ google.golang.org/genproto v0.0.0-20200312145019-da6875a35672/go.mod h1:55QSHmfG google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200430143042-b979b6f78d84/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200511104702-f5ebc3bea380/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200515170657-fc4c6c6a6587/go.mod h1:YsZOwe1myG/8QRHRsmBRE1LrgQY60beZKjly0O1fX9U= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA= google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20200904004341-0bd0a958aa1d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20201019141844-1ed22bb0c154/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20201109203340-2640f1f9cdfb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201110150050-8816d57aaa9a h1:pOwg4OoaRYScjmR4LlLgdtnyoHYTSAVhhqe5uPdpII8= google.golang.org/genproto v0.0.0-20201110150050-8816d57aaa9a/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20201201144952-b05cb90ed32e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20201210142538-e3217bee35cc/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20201214200347-8c77b98c765d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210222152913-aa3ee6e6a81c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210303154014-9728d6b83eeb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210310155132-4ce2db91004e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210319143718-93e7006c17a6/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210402141018-6c239bbf2bb1/go.mod h1:9lPAdzaEmUacj36I+k7YKbEc5CXzPIeORRgDAUOu28A= -google.golang.org/genproto v0.0.0-20210513213006-bf773b8c8384/go.mod h1:P3QM42oQyzQSnHPnZ/vqoCdDmzH28fzWByN9asMeM8A= -google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= -google.golang.org/genproto v0.0.0-20210604141403-392c879c8b08/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= -google.golang.org/genproto v0.0.0-20210608205507-b6d2f5bf0d7d/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= -google.golang.org/genproto v0.0.0-20210624195500-8bfb893ecb84/go.mod h1:SzzZ/N+nwJDaO1kznhnlzqS8ocJICar6hYhVyhi++24= -google.golang.org/genproto v0.0.0-20210713002101-d411969a0d9a/go.mod h1:AxrInvYm1dci+enl5hChSFPOmmUF1+uAa/UsgNRWd7k= -google.golang.org/genproto v0.0.0-20210716133855-ce7ef5c701ea/go.mod h1:AxrInvYm1dci+enl5hChSFPOmmUF1+uAa/UsgNRWd7k= -google.golang.org/genproto v0.0.0-20210728212813-7823e685a01f/go.mod h1:ob2IJxKrgPT52GcgX759i1sleT07tiKowYBGbczaW48= -google.golang.org/genproto v0.0.0-20210805201207-89edb61ffb67/go.mod h1:ob2IJxKrgPT52GcgX759i1sleT07tiKowYBGbczaW48= -google.golang.org/genproto v0.0.0-20210813162853-db860fec028c/go.mod h1:cFeNkxwySK631ADgubI+/XFU/xp8FD5KIVV4rj8UC5w= -google.golang.org/genproto v0.0.0-20210821163610-241b8fcbd6c8/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= -google.golang.org/genproto v0.0.0-20210828152312-66f60bf46e71/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= -google.golang.org/genproto v0.0.0-20210831024726-fe130286e0e2/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= -google.golang.org/genproto v0.0.0-20210903162649-d08c68adba83/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= -google.golang.org/genproto v0.0.0-20210924002016-3dee208752a0 h1:5Tbluzus3QxoAJx4IefGt1W0HQZW4nuMrVk684jI74Q= -google.golang.org/genproto v0.0.0-20210924002016-3dee208752a0/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/grpc v0.0.0-20160317175043-d3ddb4469d5a/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= @@ -1320,22 +1064,8 @@ google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8 google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60= google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.31.0 h1:T7P4R73V3SSDPhH7WW7ATbfViLtmamH0DKrP3f9AuDI= google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= -google.golang.org/grpc v1.31.1/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= -google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= -google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= -google.golang.org/grpc v1.34.0/go.mod h1:WotjhfgOW/POjDeRt8vscBtXq+2VjORFy659qA51WJ8= -google.golang.org/grpc v1.35.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= -google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= -google.golang.org/grpc v1.36.1/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= -google.golang.org/grpc v1.37.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= -google.golang.org/grpc v1.37.1/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= -google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= -google.golang.org/grpc v1.39.0/go.mod h1:PImNr+rS9TWYb2O4/emRugxiyHZ5JyHW5F+RPnDzfrE= -google.golang.org/grpc v1.39.1/go.mod h1:PImNr+rS9TWYb2O4/emRugxiyHZ5JyHW5F+RPnDzfrE= -google.golang.org/grpc v1.40.0 h1:AGJ0Ih4mHjSeibYkFGh1dD9KJ/eOtZ93I6hoHhukQ5Q= -google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= -google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= @@ -1348,8 +1078,6 @@ google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGj google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w= google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/airbrake/gobrake.v2 v2.0.9/go.mod h1:/h5ZAUhDkGaJfjzjKLSjv6zCL6O0LLBxU4K+aSYdM/U= @@ -1366,7 +1094,6 @@ gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/gemnasium/logrus-airbrake-hook.v2 v2.1.2/go.mod h1:Xk6kEKp8OKb+X14hQBKWaSkCsqBpgog8nAV2xsGOxlo= gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= -gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA= gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/natefinch/lumberjack.v2 v2.0.0/go.mod h1:l0ndWWf7gzL7RNwBG7wST/UCcT4T24xpD6X8LsfU/+k= @@ -1389,11 +1116,9 @@ gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo= gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw= gotest.tools/v3 v3.0.2/go.mod h1:3SzNCllyD9/Y+b5r9JIKQ474KzkZyqLqEfYqMsX94Bk= gotest.tools/v3 v3.0.3 h1:4AuOwCGf4lLR9u3YOe2awrHygurzhO/HeQ6laiA6Sx0= @@ -1406,33 +1131,22 @@ honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= k8s.io/api v0.20.1/go.mod h1:KqwcCVogGxQY3nBlRpwt+wpAMF/KjaCc7RpywacvqUo= -k8s.io/api v0.25.0/go.mod h1:ttceV1GyV1i1rnmvzT3BST08N6nGt+dudGrquzVQWPk= k8s.io/apimachinery v0.20.1/go.mod h1:WlLqWAHZGg07AeltaI0MV5uk1Omp8xaN0JGLY6gkRpU= -k8s.io/apimachinery v0.25.0/go.mod h1:qMx9eAk0sZQGsXGu86fab8tZdffHbwUfsvzqKn4mfB0= k8s.io/apiserver v0.20.1/go.mod h1:ro5QHeQkgMS7ZGpvf4tSMx6bBOgPfE+f52KwvXfScaU= k8s.io/client-go v0.20.1/go.mod h1:/zcHdt1TeWSd5HoUe6elJmHSQ6uLLgp4bIJHVEuy+/Y= -k8s.io/client-go v0.25.0/go.mod h1:lxykvypVfKilxhTklov0wz1FoaUZ8X4EwbhS6rpRfN8= k8s.io/component-base v0.20.1/go.mod h1:guxkoJnNoh8LNrbtiQOlyp2Y2XFCZQmrcg2n/DeYNLk= k8s.io/cri-api v0.17.3/go.mod h1:X1sbHmuXhwaHs9xxYffLqJogVsnI+f6cPRcgPel7ywM= k8s.io/cri-api v0.20.1/go.mod h1:2JRbKt+BFLTjtrILYVqQK5jqhI+XNdF6UiGMgczeBCI= k8s.io/gengo v0.0.0-20200413195148-3a45101e95ac/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0= -k8s.io/gengo v0.0.0-20210813121822-485abfe95c7c/go.mod h1:FiNAH4ZV3gBg2Kwh89tzAEV2be7d5xI0vBa/VySYy3E= k8s.io/klog/v2 v2.0.0/go.mod h1:PBfzABfn139FHAV07az/IF9Wp1bkk3vpT2XSJ76fSDE= -k8s.io/klog/v2 v2.2.0/go.mod h1:Od+F08eJP+W3HUb4pSrPpgp9DGU4GzlpG/TmITuYh/Y= k8s.io/klog/v2 v2.4.0/go.mod h1:Od+F08eJP+W3HUb4pSrPpgp9DGU4GzlpG/TmITuYh/Y= -k8s.io/klog/v2 v2.70.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0= k8s.io/kube-openapi v0.0.0-20201113171705-d219536bb9fd/go.mod h1:WOJ3KddDSol4tAGcJo0Tvi+dK12EcqSLqcWsryKMpfM= -k8s.io/kube-openapi v0.0.0-20220803162953-67bda5d908f1/go.mod h1:C/N6wCaBHeBHkHUesQOQy2/MZqGgMAFPqGsGQLdbZBU= k8s.io/kubernetes v1.13.0/go.mod h1:ocZa8+6APFNC2tX1DZASIbocyYT5jHzqFVsY5aoB7Jk= k8s.io/utils v0.0.0-20201110183641-67b214c5f920/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA= -k8s.io/utils v0.0.0-20210802155522-efc7438f0176/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA= -k8s.io/utils v0.0.0-20220728103510-ee6ede2d64ed/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.0.14/go.mod h1:LEScyzhFmoF5pso/YSeBstl57mOzx9xlU9n85RGrDQg= -sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2/go.mod h1:B8JuhiUyNFVKdsE8h686QcCxMaH6HrOAZj4vswFpcB0= sigs.k8s.io/structured-merge-diff/v4 v4.0.2/go.mod h1:bJZC9H9iH24zzfZ/41RGcq60oK1F7G282QMXDPYydCw= -sigs.k8s.io/structured-merge-diff/v4 v4.2.3/go.mod h1:qjx8mGObPmV2aSZepjQjbmb2ihdVs8cGKBraizNC69E= sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o= sigs.k8s.io/yaml v1.2.0/go.mod h1:yfXDCHCao9+ENCvLSE62v9VSji2MKu5jeNfTrofGhJc= diff --git a/server/ReverseProxy.go b/server/ReverseProxy.go index 7670c2c..93d2e21 100644 --- a/server/ReverseProxy.go +++ b/server/ReverseProxy.go @@ -2,36 +2,37 @@ package server import ( - "errors" - "fmt" - "github.com/gin-gonic/gin" - "log" - "net/http" - "net/http/httputil" - "net/url" + "errors" + "fmt" + "github.com/Akilan1999/p2p-rendering-computation/config" + "github.com/gin-gonic/gin" + "log" + "net/http" + "net/http/httputil" + "net/url" ) var ( - //RunPort = 2002 // The server port to run on - //ReverseServerAddr = fmt.Sprint("0.0.0.0:", RunPort) // this is our reverse server ip address - //InsideProxyHostname = fmt.Sprint("proxy:", RunPort) // Requests from private network - //OutsideProxyHostname = fmt.Sprint("registration.localhost:", RunPort) // Requests from public network - KnownAddresses = map[string]string{} // Known Addresses + //RunPort = 2002 // The server port to run on + //ReverseServerAddr = fmt.Sprint("0.0.0.0:", RunPort) // this is our reverse server ip address + //InsideProxyHostname = fmt.Sprint("proxy:", RunPort) // Requests from private network + //OutsideProxyHostname = fmt.Sprint("registration.localhost:", RunPort) // Requests from public network + KnownAddresses = map[string]string{} // Known Addresses ) type RegistrationRequest struct { - OutsideHost string // Outside host address. The hostname or IP on the public network. For example foo.bar.com or foo.localhost - InsideHost string // Inside host address. The hostname or IP on the internal network. For example 192.168.10.5 + OutsideHost string // Outside host address. The hostname or IP on the public network. For example foo.bar.com or foo.localhost + InsideHost string // Inside host address. The hostname or IP on the internal network. For example 192.168.10.5 } // This function checks if TLS was enabled on the request // and translates it to the proper scheme (http or https) func GetScheme(c *gin.Context) string { - if c.Request.TLS != nil { - return "https" - } else { - return "http" - } + if c.Request.TLS != nil { + return "https" + } else { + return "http" + } } // IsRegistrationRequest checks if an incoming request is meant to register @@ -64,13 +65,13 @@ func GetScheme(c *gin.Context) string { // SaveRegistration Creates registration of proxy node func SaveRegistration(OutsideHost string, InsideHost string) error { - _, ok := KnownAddresses[OutsideHost] - if !ok { - return errors.New("domain name provided already exists") - } - KnownAddresses[OutsideHost] = InsideHost + _, ok := KnownAddresses[OutsideHost] + if !ok { + return errors.New("domain name provided already exists") + } + KnownAddresses[OutsideHost] = InsideHost - return nil + return nil } // Proxy runs the actual proxy and will look at the @@ -79,57 +80,63 @@ func SaveRegistration(OutsideHost string, InsideHost string) error { // request func Proxy(c *gin.Context) { - // Get if HTTP or HTTPS - scheme := GetScheme(c) + // Get if HTTP or HTTPS + scheme := GetScheme(c) - log.Println(scheme, c.Request.Host, c.Request.URL.String()) + log.Println(scheme, c.Request.Host, c.Request.URL.String()) - // Translate the outside hostname to the inside hostname - forwardTo, ok := KnownAddresses[c.Request.Host] + // Translate the outside hostname to the inside hostname + forwardTo, ok := KnownAddresses[c.Request.Host] - if !ok { - log.Printf("Unkown Host: %v", c.Request.Host) - c.String(400, "Unkown Host") - return - } + if !ok { + log.Printf("Unkown Host: %v", c.Request.Host) + c.String(400, "Unkown Host") + return + } - rUrl := fmt.Sprintf("%v://%v%v", scheme, forwardTo, c.Request.URL) + rUrl := fmt.Sprintf("%v://%v%v", scheme, forwardTo, c.Request.URL) - remote, err := url.Parse(rUrl) + remote, err := url.Parse(rUrl) - if err != nil { - log.Println(err) - c.String(500, "Error Proxying Host") - return - } + if err != nil { + log.Println(err) + c.String(500, "Error Proxying Host") + return + } - log.Println("Forwarding request to", remote) + log.Println("Forwarding request to", remote) - // Forward the request to the inside remote server - // https://pkg.go.dev/net/http/httputil#NewSingleHostReverseProxy - proxy := httputil.NewSingleHostReverseProxy(remote) + // Forward the request to the inside remote server + // https://pkg.go.dev/net/http/httputil#NewSingleHostReverseProxy + proxy := httputil.NewSingleHostReverseProxy(remote) - // Director is a function which modifies - // the request into a new request to be sent - // https://pkg.go.dev/net/http/httputil#ReverseProxy - proxy.Director = func(req *http.Request) { - req.Header = c.Request.Header - req.Host = remote.Host - req.URL.Scheme = remote.Scheme - req.URL.Host = remote.Host - req.URL.Path = c.Param("path") - } + // Director is a function which modifies + // the request into a new request to be sent + // https://pkg.go.dev/net/http/httputil#ReverseProxy + proxy.Director = func(req *http.Request) { + req.Header = c.Request.Header + req.Host = remote.Host + req.URL.Scheme = remote.Scheme + req.URL.Host = remote.Host + req.URL.Path = c.Param("path") + } - proxy.ServeHTTP(c.Writer, c.Request) + proxy.ServeHTTP(c.Writer, c.Request) } func ProxyRun(port string) { - r := gin.Default() + r := gin.Default() - // all paths should be handled by Proxy() - r.Any("/*path", Proxy) + // Get config information + Config, err := config.ConfigInit(nil, nil) + if err != nil { + log.Printf("Error: %v", err) + } - if err := r.Run(fmt.Sprint("0.0.0.0:", port)); err != nil { - log.Printf("Error: %v", err) - } + // all paths should be handled by Proxy() + r.Any("/*path", Proxy) + + if err := r.RunTLS(fmt.Sprint("0.0.0.0:", port), Config.KeyFile, Config.PemFile); err != nil { + log.Printf("Error: %v", err) + } } From a4cd96c72f88939c16eba17a67543088f9d8fa56 Mon Sep 17 00:00:00 2001 From: Akilan Date: Fri, 23 Aug 2024 03:25:25 +0100 Subject: [PATCH 07/18] fixed flipped pem files --- server/ReverseProxy.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/ReverseProxy.go b/server/ReverseProxy.go index 93d2e21..9feb79d 100644 --- a/server/ReverseProxy.go +++ b/server/ReverseProxy.go @@ -136,7 +136,7 @@ func ProxyRun(port string) { // all paths should be handled by Proxy() r.Any("/*path", Proxy) - if err := r.RunTLS(fmt.Sprint("0.0.0.0:", port), Config.KeyFile, Config.PemFile); err != nil { + if err := r.RunTLS(fmt.Sprint("0.0.0.0:", port), Config.PemFile, Config.KeyFile); err != nil { log.Printf("Error: %v", err) } } From 63d079f71db6137c3be1ac05da8e9f1539320e85 Mon Sep 17 00:00:00 2001 From: Akilan Date: Fri, 23 Aug 2024 03:42:02 +0100 Subject: [PATCH 08/18] added make for create map --- server/ReverseProxy.go | 140 +++++++++++++++++++++-------------------- 1 file changed, 71 insertions(+), 69 deletions(-) diff --git a/server/ReverseProxy.go b/server/ReverseProxy.go index 9feb79d..46fa736 100644 --- a/server/ReverseProxy.go +++ b/server/ReverseProxy.go @@ -2,37 +2,37 @@ package server import ( - "errors" - "fmt" - "github.com/Akilan1999/p2p-rendering-computation/config" - "github.com/gin-gonic/gin" - "log" - "net/http" - "net/http/httputil" - "net/url" + "errors" + "fmt" + "github.com/Akilan1999/p2p-rendering-computation/config" + "github.com/gin-gonic/gin" + "log" + "net/http" + "net/http/httputil" + "net/url" ) var ( - //RunPort = 2002 // The server port to run on - //ReverseServerAddr = fmt.Sprint("0.0.0.0:", RunPort) // this is our reverse server ip address - //InsideProxyHostname = fmt.Sprint("proxy:", RunPort) // Requests from private network - //OutsideProxyHostname = fmt.Sprint("registration.localhost:", RunPort) // Requests from public network - KnownAddresses = map[string]string{} // Known Addresses + //RunPort = 2002 // The server port to run on + //ReverseServerAddr = fmt.Sprint("0.0.0.0:", RunPort) // this is our reverse server ip address + //InsideProxyHostname = fmt.Sprint("proxy:", RunPort) // Requests from private network + //OutsideProxyHostname = fmt.Sprint("registration.localhost:", RunPort) // Requests from public network + KnownAddresses = map[string]string{} // Known Addresses ) type RegistrationRequest struct { - OutsideHost string // Outside host address. The hostname or IP on the public network. For example foo.bar.com or foo.localhost - InsideHost string // Inside host address. The hostname or IP on the internal network. For example 192.168.10.5 + OutsideHost string // Outside host address. The hostname or IP on the public network. For example foo.bar.com or foo.localhost + InsideHost string // Inside host address. The hostname or IP on the internal network. For example 192.168.10.5 } // This function checks if TLS was enabled on the request // and translates it to the proper scheme (http or https) func GetScheme(c *gin.Context) string { - if c.Request.TLS != nil { - return "https" - } else { - return "http" - } + if c.Request.TLS != nil { + return "https" + } else { + return "http" + } } // IsRegistrationRequest checks if an incoming request is meant to register @@ -65,13 +65,13 @@ func GetScheme(c *gin.Context) string { // SaveRegistration Creates registration of proxy node func SaveRegistration(OutsideHost string, InsideHost string) error { - _, ok := KnownAddresses[OutsideHost] - if !ok { - return errors.New("domain name provided already exists") - } - KnownAddresses[OutsideHost] = InsideHost + _, ok := KnownAddresses[OutsideHost] + if !ok { + return errors.New("domain name provided already exists") + } + KnownAddresses[OutsideHost] = InsideHost - return nil + return nil } // Proxy runs the actual proxy and will look at the @@ -80,63 +80,65 @@ func SaveRegistration(OutsideHost string, InsideHost string) error { // request func Proxy(c *gin.Context) { - // Get if HTTP or HTTPS - scheme := GetScheme(c) + // Get if HTTP or HTTPS + scheme := GetScheme(c) - log.Println(scheme, c.Request.Host, c.Request.URL.String()) + log.Println(scheme, c.Request.Host, c.Request.URL.String()) - // Translate the outside hostname to the inside hostname - forwardTo, ok := KnownAddresses[c.Request.Host] + // Translate the outside hostname to the inside hostname + forwardTo, ok := KnownAddresses[c.Request.Host] - if !ok { - log.Printf("Unkown Host: %v", c.Request.Host) - c.String(400, "Unkown Host") - return - } + if !ok { + log.Printf("Unkown Host: %v", c.Request.Host) + c.String(400, "Unkown Host") + return + } - rUrl := fmt.Sprintf("%v://%v%v", scheme, forwardTo, c.Request.URL) + rUrl := fmt.Sprintf("%v://%v%v", scheme, forwardTo, c.Request.URL) - remote, err := url.Parse(rUrl) + remote, err := url.Parse(rUrl) - if err != nil { - log.Println(err) - c.String(500, "Error Proxying Host") - return - } + if err != nil { + log.Println(err) + c.String(500, "Error Proxying Host") + return + } - log.Println("Forwarding request to", remote) + log.Println("Forwarding request to", remote) - // Forward the request to the inside remote server - // https://pkg.go.dev/net/http/httputil#NewSingleHostReverseProxy - proxy := httputil.NewSingleHostReverseProxy(remote) + // Forward the request to the inside remote server + // https://pkg.go.dev/net/http/httputil#NewSingleHostReverseProxy + proxy := httputil.NewSingleHostReverseProxy(remote) - // Director is a function which modifies - // the request into a new request to be sent - // https://pkg.go.dev/net/http/httputil#ReverseProxy - proxy.Director = func(req *http.Request) { - req.Header = c.Request.Header - req.Host = remote.Host - req.URL.Scheme = remote.Scheme - req.URL.Host = remote.Host - req.URL.Path = c.Param("path") - } + // Director is a function which modifies + // the request into a new request to be sent + // https://pkg.go.dev/net/http/httputil#ReverseProxy + proxy.Director = func(req *http.Request) { + req.Header = c.Request.Header + req.Host = remote.Host + req.URL.Scheme = remote.Scheme + req.URL.Host = remote.Host + req.URL.Path = c.Param("path") + } - proxy.ServeHTTP(c.Writer, c.Request) + proxy.ServeHTTP(c.Writer, c.Request) } func ProxyRun(port string) { - r := gin.Default() + r := gin.Default() - // Get config information - Config, err := config.ConfigInit(nil, nil) - if err != nil { - log.Printf("Error: %v", err) - } + KnownAddresses = make(map[string]string) - // all paths should be handled by Proxy() - r.Any("/*path", Proxy) + // Get config information + Config, err := config.ConfigInit(nil, nil) + if err != nil { + log.Printf("Error: %v", err) + } - if err := r.RunTLS(fmt.Sprint("0.0.0.0:", port), Config.PemFile, Config.KeyFile); err != nil { - log.Printf("Error: %v", err) - } + // all paths should be handled by Proxy() + r.Any("/*path", Proxy) + + if err := r.RunTLS(fmt.Sprint("0.0.0.0:", port), Config.PemFile, Config.KeyFile); err != nil { + log.Printf("Error: %v", err) + } } From 2c8ef44bd8c5f43ab7823717bdcd9a26753e21b4 Mon Sep 17 00:00:00 2001 From: Akilan Date: Fri, 23 Aug 2024 03:45:01 +0100 Subject: [PATCH 09/18] removed map check --- server/ReverseProxy.go | 140 ++++++++++++++++++++--------------------- 1 file changed, 70 insertions(+), 70 deletions(-) diff --git a/server/ReverseProxy.go b/server/ReverseProxy.go index 46fa736..fcdacde 100644 --- a/server/ReverseProxy.go +++ b/server/ReverseProxy.go @@ -2,37 +2,37 @@ package server import ( - "errors" - "fmt" - "github.com/Akilan1999/p2p-rendering-computation/config" - "github.com/gin-gonic/gin" - "log" - "net/http" - "net/http/httputil" - "net/url" + "errors" + "fmt" + "github.com/Akilan1999/p2p-rendering-computation/config" + "github.com/gin-gonic/gin" + "log" + "net/http" + "net/http/httputil" + "net/url" ) var ( - //RunPort = 2002 // The server port to run on - //ReverseServerAddr = fmt.Sprint("0.0.0.0:", RunPort) // this is our reverse server ip address - //InsideProxyHostname = fmt.Sprint("proxy:", RunPort) // Requests from private network - //OutsideProxyHostname = fmt.Sprint("registration.localhost:", RunPort) // Requests from public network - KnownAddresses = map[string]string{} // Known Addresses + //RunPort = 2002 // The server port to run on + //ReverseServerAddr = fmt.Sprint("0.0.0.0:", RunPort) // this is our reverse server ip address + //InsideProxyHostname = fmt.Sprint("proxy:", RunPort) // Requests from private network + //OutsideProxyHostname = fmt.Sprint("registration.localhost:", RunPort) // Requests from public network + KnownAddresses = map[string]string{} // Known Addresses ) type RegistrationRequest struct { - OutsideHost string // Outside host address. The hostname or IP on the public network. For example foo.bar.com or foo.localhost - InsideHost string // Inside host address. The hostname or IP on the internal network. For example 192.168.10.5 + OutsideHost string // Outside host address. The hostname or IP on the public network. For example foo.bar.com or foo.localhost + InsideHost string // Inside host address. The hostname or IP on the internal network. For example 192.168.10.5 } // This function checks if TLS was enabled on the request // and translates it to the proper scheme (http or https) func GetScheme(c *gin.Context) string { - if c.Request.TLS != nil { - return "https" - } else { - return "http" - } + if c.Request.TLS != nil { + return "https" + } else { + return "http" + } } // IsRegistrationRequest checks if an incoming request is meant to register @@ -65,13 +65,13 @@ func GetScheme(c *gin.Context) string { // SaveRegistration Creates registration of proxy node func SaveRegistration(OutsideHost string, InsideHost string) error { - _, ok := KnownAddresses[OutsideHost] - if !ok { - return errors.New("domain name provided already exists") - } - KnownAddresses[OutsideHost] = InsideHost + _, ok := KnownAddresses[OutsideHost] + if !ok { + return errors.New("domain name provided already exists") + } + KnownAddresses[OutsideHost] = InsideHost - return nil + return nil } // Proxy runs the actual proxy and will look at the @@ -80,65 +80,65 @@ func SaveRegistration(OutsideHost string, InsideHost string) error { // request func Proxy(c *gin.Context) { - // Get if HTTP or HTTPS - scheme := GetScheme(c) + // Get if HTTP or HTTPS + scheme := GetScheme(c) - log.Println(scheme, c.Request.Host, c.Request.URL.String()) + log.Println(scheme, c.Request.Host, c.Request.URL.String()) - // Translate the outside hostname to the inside hostname - forwardTo, ok := KnownAddresses[c.Request.Host] + // Translate the outside hostname to the inside hostname + forwardTo, _ := KnownAddresses[c.Request.Host] - if !ok { - log.Printf("Unkown Host: %v", c.Request.Host) - c.String(400, "Unkown Host") - return - } + //if !ok { + // log.Printf("Unkown Host: %v", c.Request.Host) + // c.String(400, "Unkown Host") + // return + //} - rUrl := fmt.Sprintf("%v://%v%v", scheme, forwardTo, c.Request.URL) + rUrl := fmt.Sprintf("%v://%v%v", scheme, forwardTo, c.Request.URL) - remote, err := url.Parse(rUrl) + remote, err := url.Parse(rUrl) - if err != nil { - log.Println(err) - c.String(500, "Error Proxying Host") - return - } + if err != nil { + log.Println(err) + c.String(500, "Error Proxying Host") + return + } - log.Println("Forwarding request to", remote) + log.Println("Forwarding request to", remote) - // Forward the request to the inside remote server - // https://pkg.go.dev/net/http/httputil#NewSingleHostReverseProxy - proxy := httputil.NewSingleHostReverseProxy(remote) + // Forward the request to the inside remote server + // https://pkg.go.dev/net/http/httputil#NewSingleHostReverseProxy + proxy := httputil.NewSingleHostReverseProxy(remote) - // Director is a function which modifies - // the request into a new request to be sent - // https://pkg.go.dev/net/http/httputil#ReverseProxy - proxy.Director = func(req *http.Request) { - req.Header = c.Request.Header - req.Host = remote.Host - req.URL.Scheme = remote.Scheme - req.URL.Host = remote.Host - req.URL.Path = c.Param("path") - } + // Director is a function which modifies + // the request into a new request to be sent + // https://pkg.go.dev/net/http/httputil#ReverseProxy + proxy.Director = func(req *http.Request) { + req.Header = c.Request.Header + req.Host = remote.Host + req.URL.Scheme = remote.Scheme + req.URL.Host = remote.Host + req.URL.Path = c.Param("path") + } - proxy.ServeHTTP(c.Writer, c.Request) + proxy.ServeHTTP(c.Writer, c.Request) } func ProxyRun(port string) { - r := gin.Default() + r := gin.Default() - KnownAddresses = make(map[string]string) + KnownAddresses = make(map[string]string) - // Get config information - Config, err := config.ConfigInit(nil, nil) - if err != nil { - log.Printf("Error: %v", err) - } + // Get config information + Config, err := config.ConfigInit(nil, nil) + if err != nil { + log.Printf("Error: %v", err) + } - // all paths should be handled by Proxy() - r.Any("/*path", Proxy) + // all paths should be handled by Proxy() + r.Any("/*path", Proxy) - if err := r.RunTLS(fmt.Sprint("0.0.0.0:", port), Config.PemFile, Config.KeyFile); err != nil { - log.Printf("Error: %v", err) - } + if err := r.RunTLS(fmt.Sprint("0.0.0.0:", port), Config.PemFile, Config.KeyFile); err != nil { + log.Printf("Error: %v", err) + } } From 883b3a5cde874e887c1e5b0c5ca938039fbd3bd0 Mon Sep 17 00:00:00 2001 From: Akilan Date: Fri, 23 Aug 2024 03:47:19 +0100 Subject: [PATCH 10/18] debug changes --- server/ReverseProxy.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/server/ReverseProxy.go b/server/ReverseProxy.go index fcdacde..afcc6c9 100644 --- a/server/ReverseProxy.go +++ b/server/ReverseProxy.go @@ -71,6 +71,10 @@ func SaveRegistration(OutsideHost string, InsideHost string) error { } KnownAddresses[OutsideHost] = InsideHost + fmt.Println(OutsideHost) + fmt.Println(InsideHost) + fmt.Println(KnownAddresses[OutsideHost]) + return nil } From 447834b556fd2c3ee0175802153ef642bfc1c656 Mon Sep 17 00:00:00 2001 From: Akilan Date: Fri, 23 Aug 2024 03:50:28 +0100 Subject: [PATCH 11/18] debug changes --- server/server.go | 686 ++++++++++++++++++++++++----------------------- 1 file changed, 344 insertions(+), 342 deletions(-) diff --git a/server/server.go b/server/server.go index 592a910..030eae2 100644 --- a/server/server.go +++ b/server/server.go @@ -1,422 +1,424 @@ package server import ( - b64 "encoding/base64" - "encoding/json" - "errors" - "fmt" - "github.com/Akilan1999/p2p-rendering-computation/client/clientIPTable" - "github.com/Akilan1999/p2p-rendering-computation/config" - "github.com/Akilan1999/p2p-rendering-computation/p2p" - "github.com/Akilan1999/p2p-rendering-computation/p2p/frp" - "github.com/Akilan1999/p2p-rendering-computation/server/docker" - "github.com/gin-gonic/gin" - "io/ioutil" - "net/http" - "strconv" - "time" + b64 "encoding/base64" + "encoding/json" + "errors" + "fmt" + "github.com/Akilan1999/p2p-rendering-computation/client/clientIPTable" + "github.com/Akilan1999/p2p-rendering-computation/config" + "github.com/Akilan1999/p2p-rendering-computation/p2p" + "github.com/Akilan1999/p2p-rendering-computation/p2p/frp" + "github.com/Akilan1999/p2p-rendering-computation/server/docker" + "github.com/gin-gonic/gin" + "io/ioutil" + "net/http" + "strconv" + "time" ) type ReverseProxy struct { - IPAddress string - Port string + IPAddress string + Port string } // ReverseProxies Reverse to the map such as ReverseProxies[]ReverseProxy type var ReverseProxies map[string]ReverseProxy func Server() (*gin.Engine, error) { - r := gin.Default() + r := gin.Default() - // "The make function allocates and initializes a hash map data - //structure and returns a map value that points to it. - //The specifics of that data structure are an implementation - //detail of the runtime and are not specified by the language itself." - // source: https://go.dev/blog/maps - ReverseProxies = make(map[string]ReverseProxy) + // "The make function allocates and initializes a hash map data + //structure and returns a map value that points to it. + //The specifics of that data structure are an implementation + //detail of the runtime and are not specified by the language itself." + // source: https://go.dev/blog/maps + ReverseProxies = make(map[string]ReverseProxy) - //Get Server port based on the config file - config, err := config.ConfigInit(nil, nil) - if err != nil { - return nil, err - } + //Get Server port based on the config file + config, err := config.ConfigInit(nil, nil) + if err != nil { + return nil, err + } - // update IPTable with new port and ip address and update ip table - var ProxyIpAddr p2p.IpAddress - var lowestLatencyIpAddress p2p.IpAddress + // update IPTable with new port and ip address and update ip table + var ProxyIpAddr p2p.IpAddress + var lowestLatencyIpAddress p2p.IpAddress - // Gets default information of the server - r.GET("/server_info", func(c *gin.Context) { - c.JSON(http.StatusOK, ServerInfo()) - }) + // Gets default information of the server + r.GET("/server_info", func(c *gin.Context) { + c.JSON(http.StatusOK, ServerInfo()) + }) - // Speed test with 50 mbps - r.GET("/50", func(c *gin.Context) { - // Get Path from config - c.File(config.SpeedTestFile) - }) + // Speed test with 50 mbps + r.GET("/50", func(c *gin.Context) { + // Get Path from config + c.File(config.SpeedTestFile) + }) - // Route build to do a speed test - r.GET("/upload", func(c *gin.Context) { - file, _ := c.FormFile("file") + // Route build to do a speed test + r.GET("/upload", func(c *gin.Context) { + file, _ := c.FormFile("file") - // Upload the file to specific dst. - // c.SaveUploadedFile(file, dst) + // Upload the file to specific dst. + // c.SaveUploadedFile(file, dst) - c.String(http.StatusOK, fmt.Sprintf("'%s' uploaded!", file.Filename)) - }) + c.String(http.StatusOK, fmt.Sprintf("'%s' uploaded!", file.Filename)) + }) - //Gets Ip Table from server node - r.POST("/IpTable", func(c *gin.Context) { - // Getting IPV4 address of client - var ClientHost p2p.IpAddress + //Gets Ip Table from server node + r.POST("/IpTable", func(c *gin.Context) { + // Getting IPV4 address of client + var ClientHost p2p.IpAddress - if p2p.Ip4or6(c.ClientIP()) == "version 6" { - ClientHost.Ipv6 = c.ClientIP() - } else { - ClientHost.Ipv4 = c.ClientIP() - } + if p2p.Ip4or6(c.ClientIP()) == "version 6" { + ClientHost.Ipv6 = c.ClientIP() + } else { + ClientHost.Ipv4 = c.ClientIP() + } - // Variable to store IP table information - var IPTable p2p.IpAddresses + // Variable to store IP table information + var IPTable p2p.IpAddresses - // Receive file from POST request - body, err := c.FormFile("json") - if err != nil { - c.String(http.StatusOK, fmt.Sprint(err)) - } + // Receive file from POST request + body, err := c.FormFile("json") + if err != nil { + c.String(http.StatusOK, fmt.Sprint(err)) + } - // Open file - open, err := body.Open() - if err != nil { - c.String(http.StatusOK, fmt.Sprint(err)) - } + // Open file + open, err := body.Open() + if err != nil { + c.String(http.StatusOK, fmt.Sprint(err)) + } - // Open received file - file, err := ioutil.ReadAll(open) - if err != nil { - c.String(http.StatusOK, fmt.Sprint(err)) - } + // Open received file + file, err := ioutil.ReadAll(open) + if err != nil { + c.String(http.StatusOK, fmt.Sprint(err)) + } - json.Unmarshal(file, &IPTable) + json.Unmarshal(file, &IPTable) - //Add Client IP address to IPTable struct - IPTable.IpAddress = append(IPTable.IpAddress, ClientHost) + //Add Client IP address to IPTable struct + IPTable.IpAddress = append(IPTable.IpAddress, ClientHost) - // Runs speed test to return only servers in the IP table pingable - err = IPTable.SpeedTestUpdatedIPTable() - if err != nil { - c.String(http.StatusOK, fmt.Sprint(err)) - } + // Runs speed test to return only servers in the IP table pingable + err = IPTable.SpeedTestUpdatedIPTable() + if err != nil { + c.String(http.StatusOK, fmt.Sprint(err)) + } - // Reads IP addresses from ip table - IpAddresses, err := p2p.ReadIpTable() - if err != nil { - c.String(http.StatusOK, fmt.Sprint(err)) - } + // Reads IP addresses from ip table + IpAddresses, err := p2p.ReadIpTable() + if err != nil { + c.String(http.StatusOK, fmt.Sprint(err)) + } - c.JSON(http.StatusOK, IpAddresses) - }) + c.JSON(http.StatusOK, IpAddresses) + }) - // Starts docker container in server - r.GET("/startcontainer", func(c *gin.Context) { - // Get Number of ports to open and whether to use GPU or not - Ports := c.DefaultQuery("ports", "0") - GPU := c.DefaultQuery("GPU", "false") - ContainerName := c.DefaultQuery("ContainerName", "") - BaseImage := c.DefaultQuery("BaseImage", "") - PublicKey := c.DefaultQuery("PublicKey", "") - var PortsInt int + // Starts docker container in server + r.GET("/startcontainer", func(c *gin.Context) { + // Get Number of ports to open and whether to use GPU or not + Ports := c.DefaultQuery("ports", "0") + GPU := c.DefaultQuery("GPU", "false") + ContainerName := c.DefaultQuery("ContainerName", "") + BaseImage := c.DefaultQuery("BaseImage", "") + PublicKey := c.DefaultQuery("PublicKey", "") + var PortsInt int - if PublicKey == "" { - c.String(http.StatusInternalServerError, fmt.Sprintf("error: %s", "Publickey not passed")) - } + if PublicKey == "" { + c.String(http.StatusInternalServerError, fmt.Sprintf("error: %s", "Publickey not passed")) + } - PublicKeyDecoded, err := b64.StdEncoding.DecodeString(PublicKey) - if err != nil { - c.String(http.StatusInternalServerError, fmt.Sprintf("error: %s", err)) - } + PublicKeyDecoded, err := b64.StdEncoding.DecodeString(PublicKey) + if err != nil { + c.String(http.StatusInternalServerError, fmt.Sprintf("error: %s", err)) + } - // Convert Get Request value to int - fmt.Sscanf(Ports, "%d", &PortsInt) + // Convert Get Request value to int + fmt.Sscanf(Ports, "%d", &PortsInt) - fmt.Println(string(PublicKeyDecoded[:])) + fmt.Println(string(PublicKeyDecoded[:])) - // Creates container and returns-back result to - // access container - resp, err := docker.BuildRunContainer(PortsInt, GPU, ContainerName, BaseImage, string(PublicKeyDecoded[:])) + // Creates container and returns-back result to + // access container + resp, err := docker.BuildRunContainer(PortsInt, GPU, ContainerName, BaseImage, string(PublicKeyDecoded[:])) - if err != nil { - c.String(http.StatusInternalServerError, fmt.Sprintf("error: %s", err)) - } + if err != nil { + c.String(http.StatusInternalServerError, fmt.Sprintf("error: %s", err)) + } - // Ensures that FRP is triggered only if a proxy address is provided - if ProxyIpAddr.Ipv4 != "" && c.Request.Host != "localhost:"+config.ServerPort && c.Request.Host != "0.0.0.0:"+config.ServerPort { - resp, err = frp.StartFRPCDockerContainer(ProxyIpAddr.Ipv4, lowestLatencyIpAddress.ServerPort, resp) - if err != nil { - c.String(http.StatusInternalServerError, fmt.Sprintf("error: %s", err)) - } - } + // Ensures that FRP is triggered only if a proxy address is provided + if ProxyIpAddr.Ipv4 != "" && c.Request.Host != "localhost:"+config.ServerPort && c.Request.Host != "0.0.0.0:"+config.ServerPort { + resp, err = frp.StartFRPCDockerContainer(ProxyIpAddr.Ipv4, lowestLatencyIpAddress.ServerPort, resp) + if err != nil { + c.String(http.StatusInternalServerError, fmt.Sprintf("error: %s", err)) + } + } - c.JSON(http.StatusOK, resp) - }) + c.JSON(http.StatusOK, resp) + }) - //Remove container - r.GET("/RemoveContainer", func(c *gin.Context) { - ID := c.DefaultQuery("id", "0") - if err := docker.StopAndRemoveContainer(ID); err != nil { - c.String(http.StatusInternalServerError, fmt.Sprintf("error: %s", err)) - } - c.String(http.StatusOK, "success") - }) + //Remove container + r.GET("/RemoveContainer", func(c *gin.Context) { + ID := c.DefaultQuery("id", "0") + if err := docker.StopAndRemoveContainer(ID); err != nil { + c.String(http.StatusInternalServerError, fmt.Sprintf("error: %s", err)) + } + c.String(http.StatusOK, "success") + }) - //Show images available - r.GET("/ShowImages", func(c *gin.Context) { - resp, err := docker.ViewAllContainers() - if err != nil { - c.String(http.StatusInternalServerError, fmt.Sprintf("error: %s", err)) - } - c.JSON(http.StatusOK, resp) - }) + //Show images available + r.GET("/ShowImages", func(c *gin.Context) { + resp, err := docker.ViewAllContainers() + if err != nil { + c.String(http.StatusInternalServerError, fmt.Sprintf("error: %s", err)) + } + c.JSON(http.StatusOK, resp) + }) - // Request for port no from Server with address - r.GET("/FRPPort", func(c *gin.Context) { - port, err := frp.StartFRPProxyFromRandom() - if err != nil { - c.String(http.StatusInternalServerError, fmt.Sprintf("error: %s", err)) - } + // Request for port no from Server with address + r.GET("/FRPPort", func(c *gin.Context) { + port, err := frp.StartFRPProxyFromRandom() + if err != nil { + c.String(http.StatusInternalServerError, fmt.Sprintf("error: %s", err)) + } - c.String(http.StatusOK, strconv.Itoa(port)) - }) + c.String(http.StatusOK, strconv.Itoa(port)) + }) - r.GET("/MAPPort", func(c *gin.Context) { - Ports := c.DefaultQuery("port", "0") - DomainName := c.DefaultQuery("domain_name", "0") - url, _, err := MapPort(Ports, DomainName) - if err != nil { - c.String(http.StatusInternalServerError, fmt.Sprintf("error: %s", err)) - } + r.GET("/MAPPort", func(c *gin.Context) { + Ports := c.DefaultQuery("port", "0") + DomainName := c.DefaultQuery("domain_name", "") + url, _, err := MapPort(Ports, DomainName) + if err != nil { + c.String(http.StatusInternalServerError, fmt.Sprintf("error: %s", err)) + } - c.String(http.StatusOK, url) - }) + c.String(http.StatusOK, url) + }) - //r.GET("/AddProxy", func(c *gin.Context) { - // DomainName := c.DefaultQuery("domain_name", "") - // ip_address := c.DefaultQuery("ip_address", "") - // Ports := c.DefaultQuery("port", "") - // - // if DomainName == "" || ip_address == "" || Ports == "" { - // c.String(http.StatusInternalServerError, fmt.Sprintf("All get parameters npt provided"+ - // " do ensure domain_name, ip_Address and port no is provided")) - // } - // - // SaveRegistration(DomainName, ip_address+":"+Ports) - // - // //_, ok := ReverseProxies[DomainName] - // //// To check if the subdomain entry exists - // //if ok { - // // c.String(http.StatusInternalServerError, fmt.Sprintf("The domain entry already exists as a reverse"+ - // // " proxy entry")) - // //} - // // - // //// added proxy as a map entry - // //ReverseProxies[DomainName] = ReverseProxy{IPAddress: ip_address, Port: Ports} - // - //}) + //r.GET("/AddProxy", func(c *gin.Context) { + // DomainName := c.DefaultQuery("domain_name", "") + // ip_address := c.DefaultQuery("ip_address", "") + // Ports := c.DefaultQuery("port", "") + // + // if DomainName == "" || ip_address == "" || Ports == "" { + // c.String(http.StatusInternalServerError, fmt.Sprintf("All get parameters npt provided"+ + // " do ensure domain_name, ip_Address and port no is provided")) + // } + // + // SaveRegistration(DomainName, ip_address+":"+Ports) + // + // //_, ok := ReverseProxies[DomainName] + // //// To check if the subdomain entry exists + // //if ok { + // // c.String(http.StatusInternalServerError, fmt.Sprintf("The domain entry already exists as a reverse"+ + // // " proxy entry")) + // //} + // // + // //// added proxy as a map entry + // //ReverseProxies[DomainName] = ReverseProxy{IPAddress: ip_address, Port: Ports} + // + //}) - //r.GET("/RemoveProxy", func(c *gin.Context) { - // DomainName := c.DefaultQuery("domain_name", "") - // - // _, ok := ReverseProxies[DomainName] - // if !ok { - // c.String(http.StatusInternalServerError, fmt.Sprintf("Domain name does exist in entries of proxies")) - // } else { - // delete(ReverseProxies, DomainName) - // } - // - //}) + //r.GET("/RemoveProxy", func(c *gin.Context) { + // DomainName := c.DefaultQuery("domain_name", "") + // + // _, ok := ReverseProxies[DomainName] + // if !ok { + // c.String(http.StatusInternalServerError, fmt.Sprintf("Domain name does exist in entries of proxies")) + // } else { + // delete(ReverseProxies, DomainName) + // } + // + //}) - // If there is a proxy port specified - // then starts the FRP server - //if config.FRPServerPort != "0" { - // go frp.StartFRPProxyFromRandom() - //} + // If there is a proxy port specified + // then starts the FRP server + //if config.FRPServerPort != "0" { + // go frp.StartFRPProxyFromRandom() + //} - // Remove nodes currently not pingable - clientIPTable.RemoveOfflineNodes() + // Remove nodes currently not pingable + clientIPTable.RemoveOfflineNodes() - table, err := p2p.ReadIpTable() + table, err := p2p.ReadIpTable() - // TODO check if IPV6 or Proxy port is specified - // if not update current entry as proxy address - // with appropriate port on IP Table - if config.BehindNAT == "True" { - if err != nil { - return nil, err - } + // TODO check if IPV6 or Proxy port is specified + // if not update current entry as proxy address + // with appropriate port on IP Table + if config.BehindNAT == "True" { + if err != nil { + return nil, err + } - var lowestLatency int64 - // random large number - lowestLatency = 10000000 + var lowestLatency int64 + // random large number + lowestLatency = 10000000 - for i, _ := range table.IpAddress { - // Checks if the ping is the lowest and if the following node is acting as a proxy - //if table.IpAddress[i].Latency.Milliseconds() < lowestLatency && table.IpAddress[i].ProxyPort != "" { - if table.IpAddress[i].Latency.Milliseconds() < lowestLatency && table.IpAddress[i].NAT != "" { - lowestLatency = table.IpAddress[i].Latency.Milliseconds() - lowestLatencyIpAddress = table.IpAddress[i] - } - } + for i, _ := range table.IpAddress { + // Checks if the ping is the lowest and if the following node is acting as a proxy + //if table.IpAddress[i].Latency.Milliseconds() < lowestLatency && table.IpAddress[i].ProxyPort != "" { + if table.IpAddress[i].Latency.Milliseconds() < lowestLatency && table.IpAddress[i].NAT != "" { + lowestLatency = table.IpAddress[i].Latency.Milliseconds() + lowestLatencyIpAddress = table.IpAddress[i] + } + } - // If there is an identified node - if lowestLatency != 10000000 { - serverPort, err := frp.GetFRPServerPort("http://" + lowestLatencyIpAddress.Ipv4 + ":" + lowestLatencyIpAddress.ServerPort) - if err != nil { - return nil, err - } - // Create 3 second delay to allow FRP server to start - time.Sleep(1 * time.Second) - // Starts FRP as a client with - proxyPort, err := frp.StartFRPClientForServer(lowestLatencyIpAddress.Ipv4, serverPort, config.ServerPort, "") - if err != nil { - return nil, err - } + // If there is an identified node + if lowestLatency != 10000000 { + serverPort, err := frp.GetFRPServerPort("http://" + lowestLatencyIpAddress.Ipv4 + ":" + lowestLatencyIpAddress.ServerPort) + if err != nil { + return nil, err + } + // Create 3 second delay to allow FRP server to start + time.Sleep(1 * time.Second) + // Starts FRP as a client with + proxyPort, err := frp.StartFRPClientForServer(lowestLatencyIpAddress.Ipv4, serverPort, config.ServerPort, "") + if err != nil { + return nil, err + } - // updating with the current proxy address - ProxyIpAddr.Ipv4 = lowestLatencyIpAddress.Ipv4 - ProxyIpAddr.ServerPort = proxyPort - ProxyIpAddr.Name = config.MachineName - ProxyIpAddr.NAT = "False" - ProxyIpAddr.ProxyServer = "False" - ProxyIpAddr.EscapeImplementation = "FRP" + // updating with the current proxy address + ProxyIpAddr.Ipv4 = lowestLatencyIpAddress.Ipv4 + ProxyIpAddr.ServerPort = proxyPort + ProxyIpAddr.Name = config.MachineName + ProxyIpAddr.NAT = "False" + ProxyIpAddr.ProxyServer = "False" + ProxyIpAddr.EscapeImplementation = "FRP" - if config.BareMetal == "True" { - _, SSHPort, err := MapPort("22", "") - if err != nil { - return nil, err - } - ProxyIpAddr.BareMetalSSHPort = SSHPort - } + if config.BareMetal == "True" { + _, SSHPort, err := MapPort("22", "") + if err != nil { + return nil, err + } + ProxyIpAddr.BareMetalSSHPort = SSHPort + } - //ProxyIpAddr.CustomInformationKey = p2p.GenerateHashSHA256(config.IPTableKey) + //ProxyIpAddr.CustomInformationKey = p2p.GenerateHashSHA256(config.IPTableKey) - // append the following to the ip table - table.IpAddress = append(table.IpAddress, ProxyIpAddr) - // write information back to the IP Table - } + // append the following to the ip table + table.IpAddress = append(table.IpAddress, ProxyIpAddr) + // write information back to the IP Table + } - } else { - ProxyIpAddr.Ipv4, err = p2p.CurrentPublicIP() - if err != nil { - fmt.Println(err) - } - ProxyIpAddr.ServerPort = config.ServerPort - ProxyIpAddr.Name = config.MachineName - ProxyIpAddr.NAT = "False" - if config.ProxyPort != "" { - ProxyIpAddr.ProxyServer = "True" - } - ProxyIpAddr.EscapeImplementation = "" - if config.BareMetal == "True" { - ProxyIpAddr.BareMetalSSHPort = "22" - } + } else { + ProxyIpAddr.Ipv4, err = p2p.CurrentPublicIP() + if err != nil { + fmt.Println(err) + } + ProxyIpAddr.ServerPort = config.ServerPort + ProxyIpAddr.Name = config.MachineName + ProxyIpAddr.NAT = "False" + if config.ProxyPort != "" { + ProxyIpAddr.ProxyServer = "True" + } + ProxyIpAddr.EscapeImplementation = "" + if config.BareMetal == "True" { + ProxyIpAddr.BareMetalSSHPort = "22" + } - table.IpAddress = append(table.IpAddress, ProxyIpAddr) + table.IpAddress = append(table.IpAddress, ProxyIpAddr) - } + } - // Writing results to the IPTable - err = table.WriteIpTable() - if err != nil { - return nil, err - } + // Writing results to the IPTable + err = table.WriteIpTable() + if err != nil { + return nil, err + } - // update ip table - go func() error { - err := clientIPTable.UpdateIpTableListClient() - if err != nil { - fmt.Println(err) - return err - } - return nil - }() + // update ip table + go func() error { + err := clientIPTable.UpdateIpTableListClient() + if err != nil { + fmt.Println(err) + return err + } + return nil + }() - if config.ProxyPort != "" { - go ProxyRun(config.ProxyPort) - } + if config.ProxyPort != "" { + go ProxyRun(config.ProxyPort) + } - // Run gin server on the specified port - go r.Run(":" + config.ServerPort) + // Run gin server on the specified port + go r.Run(":" + config.ServerPort) - return r, nil + return r, nil } func MapPort(port string, domainName string) (string, string, error) { - //Get Server port based on the config file - config, err := config.ConfigInit(nil, nil) - if err != nil { - return "", "", err - } + //Get Server port based on the config file + config, err := config.ConfigInit(nil, nil) + if err != nil { + return "", "", err + } - // update IPTable with new port and ip address and update ip table - var ProxyIpAddr p2p.IpAddress - var lowestLatencyIpAddress p2p.IpAddress + // update IPTable with new port and ip address and update ip table + var ProxyIpAddr p2p.IpAddress + var lowestLatencyIpAddress p2p.IpAddress - clientIPTable.RemoveOfflineNodes() + clientIPTable.RemoveOfflineNodes() - table, err := p2p.ReadIpTable() - if err != nil { - return "", "", err - } + table, err := p2p.ReadIpTable() + if err != nil { + return "", "", err + } - var lowestLatency int64 - // random large number - lowestLatency = 10000000 + var lowestLatency int64 + // random large number + lowestLatency = 10000000 - for i, _ := range table.IpAddress { - // Checks if the ping is the lowest and if the following node is acting as a proxy - //if table.IpAddress[i].Latency.Milliseconds() < lowestLatency && table.IpAddress[i].ProxyPort != "" { - if table.IpAddress[i].Latency.Milliseconds() < lowestLatency && table.IpAddress[i].NAT != "" { - // Filter based on nodes with proxy enabled - if domainName != "" && table.IpAddress[i].ProxyServer == "Yes" { - lowestLatency = table.IpAddress[i].Latency.Milliseconds() - lowestLatencyIpAddress = table.IpAddress[i] - continue - } - lowestLatency = table.IpAddress[i].Latency.Milliseconds() - lowestLatencyIpAddress = table.IpAddress[i] - } - } + for i, _ := range table.IpAddress { + // Checks if the ping is the lowest and if the following node is acting as a proxy + //if table.IpAddress[i].Latency.Milliseconds() < lowestLatency && table.IpAddress[i].ProxyPort != "" { + if table.IpAddress[i].Latency.Milliseconds() < lowestLatency && table.IpAddress[i].NAT != "" { + // Filter based on nodes with proxy enabled + if domainName != "" && table.IpAddress[i].ProxyServer == "Yes" { + lowestLatency = table.IpAddress[i].Latency.Milliseconds() + lowestLatencyIpAddress = table.IpAddress[i] + continue + } + lowestLatency = table.IpAddress[i].Latency.Milliseconds() + lowestLatencyIpAddress = table.IpAddress[i] + } + } - // If there is an identified node - if lowestLatency != 10000000 { - serverPort, err := frp.GetFRPServerPort("http://" + lowestLatencyIpAddress.Ipv4 + ":" + lowestLatencyIpAddress.ServerPort) - if err != nil { - return "", "", err - } - // Create 3 second delay to allow FRP server to start - time.Sleep(1 * time.Second) - // Starts FRP as a client with - proxyPort, err := frp.StartFRPClientForServer(lowestLatencyIpAddress.Ipv4, serverPort, port, "") - if err != nil { - return "", "", err - } + // If there is an identified node + if lowestLatency != 10000000 { + serverPort, err := frp.GetFRPServerPort("http://" + lowestLatencyIpAddress.Ipv4 + ":" + lowestLatencyIpAddress.ServerPort) + if err != nil { + return "", "", err + } + // Create 3 second delay to allow FRP server to start + time.Sleep(1 * time.Second) + // Starts FRP as a client with + proxyPort, err := frp.StartFRPClientForServer(lowestLatencyIpAddress.Ipv4, serverPort, port, "") + if err != nil { + return "", "", err + } - // Doing the proxy mapping for the domain name - if domainName != "" { - SaveRegistration(domainName, lowestLatencyIpAddress.Ipv4+":"+proxyPort) - } + fmt.Println(domainName) - // updating with the current proxy address - ProxyIpAddr.Ipv4 = lowestLatencyIpAddress.Ipv4 - ProxyIpAddr.ServerPort = proxyPort - ProxyIpAddr.Name = config.MachineName - ProxyIpAddr.NAT = "False" - ProxyIpAddr.EscapeImplementation = "FRP" - //ProxyIpAddr.CustomInformationKey = p2p.GenerateHashSHA256(config.IPTableKey) - } else { - return "", "", errors.New("proxy IP not found") - } + // Doing the proxy mapping for the domain name + if domainName != "" { + SaveRegistration(domainName, lowestLatencyIpAddress.Ipv4+":"+proxyPort) + } - return ProxyIpAddr.Ipv4 + ":" + ProxyIpAddr.ServerPort, ProxyIpAddr.ServerPort, nil + // updating with the current proxy address + ProxyIpAddr.Ipv4 = lowestLatencyIpAddress.Ipv4 + ProxyIpAddr.ServerPort = proxyPort + ProxyIpAddr.Name = config.MachineName + ProxyIpAddr.NAT = "False" + ProxyIpAddr.EscapeImplementation = "FRP" + //ProxyIpAddr.CustomInformationKey = p2p.GenerateHashSHA256(config.IPTableKey) + } else { + return "", "", errors.New("proxy IP not found") + } + + return ProxyIpAddr.Ipv4 + ":" + ProxyIpAddr.ServerPort, ProxyIpAddr.ServerPort, nil } From ac8a3dcdcaea071da59b6f24b897a17e0d7fc602 Mon Sep 17 00:00:00 2001 From: Akilan Date: Fri, 23 Aug 2024 03:52:41 +0100 Subject: [PATCH 12/18] debug changes --- server/server.go | 1 + 1 file changed, 1 insertion(+) diff --git a/server/server.go b/server/server.go index 030eae2..f576895 100644 --- a/server/server.go +++ b/server/server.go @@ -192,6 +192,7 @@ func Server() (*gin.Engine, error) { r.GET("/MAPPort", func(c *gin.Context) { Ports := c.DefaultQuery("port", "0") DomainName := c.DefaultQuery("domain_name", "") + fmt.Println("here ------------") url, _, err := MapPort(Ports, DomainName) if err != nil { c.String(http.StatusInternalServerError, fmt.Sprintf("error: %s", err)) From fc7ad63c067dbc544351bd09dd795b3b464597ca Mon Sep 17 00:00:00 2001 From: Akilan Date: Fri, 23 Aug 2024 04:06:36 +0100 Subject: [PATCH 13/18] debug changes --- server/ReverseProxy.go | 146 ++++----- server/server.go | 692 +++++++++++++++++++++-------------------- 2 files changed, 421 insertions(+), 417 deletions(-) diff --git a/server/ReverseProxy.go b/server/ReverseProxy.go index afcc6c9..2d567db 100644 --- a/server/ReverseProxy.go +++ b/server/ReverseProxy.go @@ -2,37 +2,37 @@ package server import ( - "errors" - "fmt" - "github.com/Akilan1999/p2p-rendering-computation/config" - "github.com/gin-gonic/gin" - "log" - "net/http" - "net/http/httputil" - "net/url" + "errors" + "fmt" + "github.com/Akilan1999/p2p-rendering-computation/config" + "github.com/gin-gonic/gin" + "log" + "net/http" + "net/http/httputil" + "net/url" ) var ( - //RunPort = 2002 // The server port to run on - //ReverseServerAddr = fmt.Sprint("0.0.0.0:", RunPort) // this is our reverse server ip address - //InsideProxyHostname = fmt.Sprint("proxy:", RunPort) // Requests from private network - //OutsideProxyHostname = fmt.Sprint("registration.localhost:", RunPort) // Requests from public network - KnownAddresses = map[string]string{} // Known Addresses + //RunPort = 2002 // The server port to run on + //ReverseServerAddr = fmt.Sprint("0.0.0.0:", RunPort) // this is our reverse server ip address + //InsideProxyHostname = fmt.Sprint("proxy:", RunPort) // Requests from private network + //OutsideProxyHostname = fmt.Sprint("registration.localhost:", RunPort) // Requests from public network + KnownAddresses = map[string]string{} // Known Addresses ) type RegistrationRequest struct { - OutsideHost string // Outside host address. The hostname or IP on the public network. For example foo.bar.com or foo.localhost - InsideHost string // Inside host address. The hostname or IP on the internal network. For example 192.168.10.5 + OutsideHost string // Outside host address. The hostname or IP on the public network. For example foo.bar.com or foo.localhost + InsideHost string // Inside host address. The hostname or IP on the internal network. For example 192.168.10.5 } // This function checks if TLS was enabled on the request // and translates it to the proper scheme (http or https) func GetScheme(c *gin.Context) string { - if c.Request.TLS != nil { - return "https" - } else { - return "http" - } + if c.Request.TLS != nil { + return "https" + } else { + return "http" + } } // IsRegistrationRequest checks if an incoming request is meant to register @@ -65,17 +65,17 @@ func GetScheme(c *gin.Context) string { // SaveRegistration Creates registration of proxy node func SaveRegistration(OutsideHost string, InsideHost string) error { - _, ok := KnownAddresses[OutsideHost] - if !ok { - return errors.New("domain name provided already exists") - } - KnownAddresses[OutsideHost] = InsideHost + _, ok := KnownAddresses[OutsideHost] + if !ok { + return errors.New("domain name provided already exists") + } + KnownAddresses[OutsideHost] = InsideHost - fmt.Println(OutsideHost) - fmt.Println(InsideHost) - fmt.Println(KnownAddresses[OutsideHost]) + fmt.Println(OutsideHost) + fmt.Println(InsideHost) + fmt.Println(KnownAddresses[OutsideHost]) - return nil + return nil } // Proxy runs the actual proxy and will look at the @@ -84,65 +84,65 @@ func SaveRegistration(OutsideHost string, InsideHost string) error { // request func Proxy(c *gin.Context) { - // Get if HTTP or HTTPS - scheme := GetScheme(c) + // Get if HTTP or HTTPS + scheme := GetScheme(c) - log.Println(scheme, c.Request.Host, c.Request.URL.String()) + log.Println(scheme, c.Request.Host, c.Request.URL.String()) - // Translate the outside hostname to the inside hostname - forwardTo, _ := KnownAddresses[c.Request.Host] + // Translate the outside hostname to the inside hostname + forwardTo, ok := KnownAddresses[c.Request.Host] - //if !ok { - // log.Printf("Unkown Host: %v", c.Request.Host) - // c.String(400, "Unkown Host") - // return - //} + if !ok { + log.Printf("Unkown Host: %v", c.Request.Host) + c.String(400, "Unkown Host") + return + } - rUrl := fmt.Sprintf("%v://%v%v", scheme, forwardTo, c.Request.URL) + rUrl := fmt.Sprintf("%v://%v%v", scheme, forwardTo, c.Request.URL) - remote, err := url.Parse(rUrl) + remote, err := url.Parse(rUrl) - if err != nil { - log.Println(err) - c.String(500, "Error Proxying Host") - return - } + if err != nil { + log.Println(err) + c.String(500, "Error Proxying Host") + return + } - log.Println("Forwarding request to", remote) + log.Println("Forwarding request to", remote) - // Forward the request to the inside remote server - // https://pkg.go.dev/net/http/httputil#NewSingleHostReverseProxy - proxy := httputil.NewSingleHostReverseProxy(remote) + // Forward the request to the inside remote server + // https://pkg.go.dev/net/http/httputil#NewSingleHostReverseProxy + proxy := httputil.NewSingleHostReverseProxy(remote) - // Director is a function which modifies - // the request into a new request to be sent - // https://pkg.go.dev/net/http/httputil#ReverseProxy - proxy.Director = func(req *http.Request) { - req.Header = c.Request.Header - req.Host = remote.Host - req.URL.Scheme = remote.Scheme - req.URL.Host = remote.Host - req.URL.Path = c.Param("path") - } + // Director is a function which modifies + // the request into a new request to be sent + // https://pkg.go.dev/net/http/httputil#ReverseProxy + proxy.Director = func(req *http.Request) { + req.Header = c.Request.Header + req.Host = remote.Host + req.URL.Scheme = remote.Scheme + req.URL.Host = remote.Host + req.URL.Path = c.Param("path") + } - proxy.ServeHTTP(c.Writer, c.Request) + proxy.ServeHTTP(c.Writer, c.Request) } func ProxyRun(port string) { - r := gin.Default() + r := gin.Default() - KnownAddresses = make(map[string]string) + KnownAddresses = make(map[string]string) - // Get config information - Config, err := config.ConfigInit(nil, nil) - if err != nil { - log.Printf("Error: %v", err) - } + // Get config information + Config, err := config.ConfigInit(nil, nil) + if err != nil { + log.Printf("Error: %v", err) + } - // all paths should be handled by Proxy() - r.Any("/*path", Proxy) + // all paths should be handled by Proxy() + r.Any("/*path", Proxy) - if err := r.RunTLS(fmt.Sprint("0.0.0.0:", port), Config.PemFile, Config.KeyFile); err != nil { - log.Printf("Error: %v", err) - } + if err := r.RunTLS(fmt.Sprint("0.0.0.0:", port), Config.PemFile, Config.KeyFile); err != nil { + log.Printf("Error: %v", err) + } } diff --git a/server/server.go b/server/server.go index f576895..7595e1a 100644 --- a/server/server.go +++ b/server/server.go @@ -1,425 +1,429 @@ package server import ( - b64 "encoding/base64" - "encoding/json" - "errors" - "fmt" - "github.com/Akilan1999/p2p-rendering-computation/client/clientIPTable" - "github.com/Akilan1999/p2p-rendering-computation/config" - "github.com/Akilan1999/p2p-rendering-computation/p2p" - "github.com/Akilan1999/p2p-rendering-computation/p2p/frp" - "github.com/Akilan1999/p2p-rendering-computation/server/docker" - "github.com/gin-gonic/gin" - "io/ioutil" - "net/http" - "strconv" - "time" + b64 "encoding/base64" + "encoding/json" + "errors" + "fmt" + "github.com/Akilan1999/p2p-rendering-computation/client/clientIPTable" + "github.com/Akilan1999/p2p-rendering-computation/config" + "github.com/Akilan1999/p2p-rendering-computation/p2p" + "github.com/Akilan1999/p2p-rendering-computation/p2p/frp" + "github.com/Akilan1999/p2p-rendering-computation/server/docker" + "github.com/gin-gonic/gin" + "io/ioutil" + "net/http" + "strconv" + "time" ) type ReverseProxy struct { - IPAddress string - Port string + IPAddress string + Port string } // ReverseProxies Reverse to the map such as ReverseProxies[]ReverseProxy type var ReverseProxies map[string]ReverseProxy func Server() (*gin.Engine, error) { - r := gin.Default() + r := gin.Default() - // "The make function allocates and initializes a hash map data - //structure and returns a map value that points to it. - //The specifics of that data structure are an implementation - //detail of the runtime and are not specified by the language itself." - // source: https://go.dev/blog/maps - ReverseProxies = make(map[string]ReverseProxy) + // "The make function allocates and initializes a hash map data + //structure and returns a map value that points to it. + //The specifics of that data structure are an implementation + //detail of the runtime and are not specified by the language itself." + // source: https://go.dev/blog/maps + ReverseProxies = make(map[string]ReverseProxy) - //Get Server port based on the config file - config, err := config.ConfigInit(nil, nil) - if err != nil { - return nil, err - } + //Get Server port based on the config file + config, err := config.ConfigInit(nil, nil) + if err != nil { + return nil, err + } - // update IPTable with new port and ip address and update ip table - var ProxyIpAddr p2p.IpAddress - var lowestLatencyIpAddress p2p.IpAddress + // update IPTable with new port and ip address and update ip table + var ProxyIpAddr p2p.IpAddress + var lowestLatencyIpAddress p2p.IpAddress - // Gets default information of the server - r.GET("/server_info", func(c *gin.Context) { - c.JSON(http.StatusOK, ServerInfo()) - }) + // Gets default information of the server + r.GET("/server_info", func(c *gin.Context) { + c.JSON(http.StatusOK, ServerInfo()) + }) - // Speed test with 50 mbps - r.GET("/50", func(c *gin.Context) { - // Get Path from config - c.File(config.SpeedTestFile) - }) + // Speed test with 50 mbps + r.GET("/50", func(c *gin.Context) { + // Get Path from config + c.File(config.SpeedTestFile) + }) - // Route build to do a speed test - r.GET("/upload", func(c *gin.Context) { - file, _ := c.FormFile("file") + // Route build to do a speed test + r.GET("/upload", func(c *gin.Context) { + file, _ := c.FormFile("file") - // Upload the file to specific dst. - // c.SaveUploadedFile(file, dst) + // Upload the file to specific dst. + // c.SaveUploadedFile(file, dst) - c.String(http.StatusOK, fmt.Sprintf("'%s' uploaded!", file.Filename)) - }) + c.String(http.StatusOK, fmt.Sprintf("'%s' uploaded!", file.Filename)) + }) - //Gets Ip Table from server node - r.POST("/IpTable", func(c *gin.Context) { - // Getting IPV4 address of client - var ClientHost p2p.IpAddress + //Gets Ip Table from server node + r.POST("/IpTable", func(c *gin.Context) { + // Getting IPV4 address of client + var ClientHost p2p.IpAddress - if p2p.Ip4or6(c.ClientIP()) == "version 6" { - ClientHost.Ipv6 = c.ClientIP() - } else { - ClientHost.Ipv4 = c.ClientIP() - } + if p2p.Ip4or6(c.ClientIP()) == "version 6" { + ClientHost.Ipv6 = c.ClientIP() + } else { + ClientHost.Ipv4 = c.ClientIP() + } - // Variable to store IP table information - var IPTable p2p.IpAddresses + // Variable to store IP table information + var IPTable p2p.IpAddresses - // Receive file from POST request - body, err := c.FormFile("json") - if err != nil { - c.String(http.StatusOK, fmt.Sprint(err)) - } + // Receive file from POST request + body, err := c.FormFile("json") + if err != nil { + c.String(http.StatusOK, fmt.Sprint(err)) + } - // Open file - open, err := body.Open() - if err != nil { - c.String(http.StatusOK, fmt.Sprint(err)) - } + // Open file + open, err := body.Open() + if err != nil { + c.String(http.StatusOK, fmt.Sprint(err)) + } - // Open received file - file, err := ioutil.ReadAll(open) - if err != nil { - c.String(http.StatusOK, fmt.Sprint(err)) - } + // Open received file + file, err := ioutil.ReadAll(open) + if err != nil { + c.String(http.StatusOK, fmt.Sprint(err)) + } - json.Unmarshal(file, &IPTable) + json.Unmarshal(file, &IPTable) - //Add Client IP address to IPTable struct - IPTable.IpAddress = append(IPTable.IpAddress, ClientHost) + //Add Client IP address to IPTable struct + IPTable.IpAddress = append(IPTable.IpAddress, ClientHost) - // Runs speed test to return only servers in the IP table pingable - err = IPTable.SpeedTestUpdatedIPTable() - if err != nil { - c.String(http.StatusOK, fmt.Sprint(err)) - } + // Runs speed test to return only servers in the IP table pingable + err = IPTable.SpeedTestUpdatedIPTable() + if err != nil { + c.String(http.StatusOK, fmt.Sprint(err)) + } - // Reads IP addresses from ip table - IpAddresses, err := p2p.ReadIpTable() - if err != nil { - c.String(http.StatusOK, fmt.Sprint(err)) - } + // Reads IP addresses from ip table + IpAddresses, err := p2p.ReadIpTable() + if err != nil { + c.String(http.StatusOK, fmt.Sprint(err)) + } - c.JSON(http.StatusOK, IpAddresses) - }) + c.JSON(http.StatusOK, IpAddresses) + }) - // Starts docker container in server - r.GET("/startcontainer", func(c *gin.Context) { - // Get Number of ports to open and whether to use GPU or not - Ports := c.DefaultQuery("ports", "0") - GPU := c.DefaultQuery("GPU", "false") - ContainerName := c.DefaultQuery("ContainerName", "") - BaseImage := c.DefaultQuery("BaseImage", "") - PublicKey := c.DefaultQuery("PublicKey", "") - var PortsInt int + // Starts docker container in server + r.GET("/startcontainer", func(c *gin.Context) { + // Get Number of ports to open and whether to use GPU or not + Ports := c.DefaultQuery("ports", "0") + GPU := c.DefaultQuery("GPU", "false") + ContainerName := c.DefaultQuery("ContainerName", "") + BaseImage := c.DefaultQuery("BaseImage", "") + PublicKey := c.DefaultQuery("PublicKey", "") + var PortsInt int - if PublicKey == "" { - c.String(http.StatusInternalServerError, fmt.Sprintf("error: %s", "Publickey not passed")) - } + if PublicKey == "" { + c.String(http.StatusInternalServerError, fmt.Sprintf("error: %s", "Publickey not passed")) + } - PublicKeyDecoded, err := b64.StdEncoding.DecodeString(PublicKey) - if err != nil { - c.String(http.StatusInternalServerError, fmt.Sprintf("error: %s", err)) - } + PublicKeyDecoded, err := b64.StdEncoding.DecodeString(PublicKey) + if err != nil { + c.String(http.StatusInternalServerError, fmt.Sprintf("error: %s", err)) + } - // Convert Get Request value to int - fmt.Sscanf(Ports, "%d", &PortsInt) + // Convert Get Request value to int + fmt.Sscanf(Ports, "%d", &PortsInt) - fmt.Println(string(PublicKeyDecoded[:])) + fmt.Println(string(PublicKeyDecoded[:])) - // Creates container and returns-back result to - // access container - resp, err := docker.BuildRunContainer(PortsInt, GPU, ContainerName, BaseImage, string(PublicKeyDecoded[:])) + // Creates container and returns-back result to + // access container + resp, err := docker.BuildRunContainer(PortsInt, GPU, ContainerName, BaseImage, string(PublicKeyDecoded[:])) - if err != nil { - c.String(http.StatusInternalServerError, fmt.Sprintf("error: %s", err)) - } + if err != nil { + c.String(http.StatusInternalServerError, fmt.Sprintf("error: %s", err)) + } - // Ensures that FRP is triggered only if a proxy address is provided - if ProxyIpAddr.Ipv4 != "" && c.Request.Host != "localhost:"+config.ServerPort && c.Request.Host != "0.0.0.0:"+config.ServerPort { - resp, err = frp.StartFRPCDockerContainer(ProxyIpAddr.Ipv4, lowestLatencyIpAddress.ServerPort, resp) - if err != nil { - c.String(http.StatusInternalServerError, fmt.Sprintf("error: %s", err)) - } - } + // Ensures that FRP is triggered only if a proxy address is provided + if ProxyIpAddr.Ipv4 != "" && c.Request.Host != "localhost:"+config.ServerPort && c.Request.Host != "0.0.0.0:"+config.ServerPort { + resp, err = frp.StartFRPCDockerContainer(ProxyIpAddr.Ipv4, lowestLatencyIpAddress.ServerPort, resp) + if err != nil { + c.String(http.StatusInternalServerError, fmt.Sprintf("error: %s", err)) + } + } - c.JSON(http.StatusOK, resp) - }) + c.JSON(http.StatusOK, resp) + }) - //Remove container - r.GET("/RemoveContainer", func(c *gin.Context) { - ID := c.DefaultQuery("id", "0") - if err := docker.StopAndRemoveContainer(ID); err != nil { - c.String(http.StatusInternalServerError, fmt.Sprintf("error: %s", err)) - } - c.String(http.StatusOK, "success") - }) + //Remove container + r.GET("/RemoveContainer", func(c *gin.Context) { + ID := c.DefaultQuery("id", "0") + if err := docker.StopAndRemoveContainer(ID); err != nil { + c.String(http.StatusInternalServerError, fmt.Sprintf("error: %s", err)) + } + c.String(http.StatusOK, "success") + }) - //Show images available - r.GET("/ShowImages", func(c *gin.Context) { - resp, err := docker.ViewAllContainers() - if err != nil { - c.String(http.StatusInternalServerError, fmt.Sprintf("error: %s", err)) - } - c.JSON(http.StatusOK, resp) - }) + //Show images available + r.GET("/ShowImages", func(c *gin.Context) { + resp, err := docker.ViewAllContainers() + if err != nil { + c.String(http.StatusInternalServerError, fmt.Sprintf("error: %s", err)) + } + c.JSON(http.StatusOK, resp) + }) - // Request for port no from Server with address - r.GET("/FRPPort", func(c *gin.Context) { - port, err := frp.StartFRPProxyFromRandom() - if err != nil { - c.String(http.StatusInternalServerError, fmt.Sprintf("error: %s", err)) - } + // Request for port no from Server with address + r.GET("/FRPPort", func(c *gin.Context) { + port, err := frp.StartFRPProxyFromRandom() + if err != nil { + c.String(http.StatusInternalServerError, fmt.Sprintf("error: %s", err)) + } - c.String(http.StatusOK, strconv.Itoa(port)) - }) + c.String(http.StatusOK, strconv.Itoa(port)) + }) - r.GET("/MAPPort", func(c *gin.Context) { - Ports := c.DefaultQuery("port", "0") - DomainName := c.DefaultQuery("domain_name", "") - fmt.Println("here ------------") - url, _, err := MapPort(Ports, DomainName) - if err != nil { - c.String(http.StatusInternalServerError, fmt.Sprintf("error: %s", err)) - } + r.GET("/MAPPort", func(c *gin.Context) { + Ports := c.DefaultQuery("port", "0") + DomainName := c.DefaultQuery("domain_name", "") + url, _, err := MapPort(Ports, DomainName) + if err != nil { + c.String(http.StatusInternalServerError, fmt.Sprintf("error: %s", err)) + } - c.String(http.StatusOK, url) - }) + c.String(http.StatusOK, url) + }) - //r.GET("/AddProxy", func(c *gin.Context) { - // DomainName := c.DefaultQuery("domain_name", "") - // ip_address := c.DefaultQuery("ip_address", "") - // Ports := c.DefaultQuery("port", "") - // - // if DomainName == "" || ip_address == "" || Ports == "" { - // c.String(http.StatusInternalServerError, fmt.Sprintf("All get parameters npt provided"+ - // " do ensure domain_name, ip_Address and port no is provided")) - // } - // - // SaveRegistration(DomainName, ip_address+":"+Ports) - // - // //_, ok := ReverseProxies[DomainName] - // //// To check if the subdomain entry exists - // //if ok { - // // c.String(http.StatusInternalServerError, fmt.Sprintf("The domain entry already exists as a reverse"+ - // // " proxy entry")) - // //} - // // - // //// added proxy as a map entry - // //ReverseProxies[DomainName] = ReverseProxy{IPAddress: ip_address, Port: Ports} - // - //}) + r.GET("/AddProxy", func(c *gin.Context) { + DomainName := c.DefaultQuery("domain_name", "") + ip_address := c.DefaultQuery("ip_address", "") + Ports := c.DefaultQuery("port", "") - //r.GET("/RemoveProxy", func(c *gin.Context) { - // DomainName := c.DefaultQuery("domain_name", "") - // - // _, ok := ReverseProxies[DomainName] - // if !ok { - // c.String(http.StatusInternalServerError, fmt.Sprintf("Domain name does exist in entries of proxies")) - // } else { - // delete(ReverseProxies, DomainName) - // } - // - //}) + if DomainName == "" || ip_address == "" || Ports == "" { + c.String(http.StatusInternalServerError, fmt.Sprintf("All get parameters npt provided"+ + " do ensure domain_name, ip_Address and port no is provided")) + } - // If there is a proxy port specified - // then starts the FRP server - //if config.FRPServerPort != "0" { - // go frp.StartFRPProxyFromRandom() - //} + SaveRegistration(DomainName, ip_address+":"+Ports) - // Remove nodes currently not pingable - clientIPTable.RemoveOfflineNodes() + //_, ok := ReverseProxies[DomainName] + //// To check if the subdomain entry exists + //if ok { + // c.String(http.StatusInternalServerError, fmt.Sprintf("The domain entry already exists as a reverse"+ + // " proxy entry")) + //} + // + //// added proxy as a map entry + //ReverseProxies[DomainName] = ReverseProxy{IPAddress: ip_address, Port: Ports} - table, err := p2p.ReadIpTable() + }) - // TODO check if IPV6 or Proxy port is specified - // if not update current entry as proxy address - // with appropriate port on IP Table - if config.BehindNAT == "True" { - if err != nil { - return nil, err - } + //r.GET("/RemoveProxy", func(c *gin.Context) { + // DomainName := c.DefaultQuery("domain_name", "") + // + // _, ok := ReverseProxies[DomainName] + // if !ok { + // c.String(http.StatusInternalServerError, fmt.Sprintf("Domain name does exist in entries of proxies")) + // } else { + // delete(ReverseProxies, DomainName) + // } + // + //}) - var lowestLatency int64 - // random large number - lowestLatency = 10000000 + // If there is a proxy port specified + // then starts the FRP server + //if config.FRPServerPort != "0" { + // go frp.StartFRPProxyFromRandom() + //} - for i, _ := range table.IpAddress { - // Checks if the ping is the lowest and if the following node is acting as a proxy - //if table.IpAddress[i].Latency.Milliseconds() < lowestLatency && table.IpAddress[i].ProxyPort != "" { - if table.IpAddress[i].Latency.Milliseconds() < lowestLatency && table.IpAddress[i].NAT != "" { - lowestLatency = table.IpAddress[i].Latency.Milliseconds() - lowestLatencyIpAddress = table.IpAddress[i] - } - } + // Remove nodes currently not pingable + clientIPTable.RemoveOfflineNodes() - // If there is an identified node - if lowestLatency != 10000000 { - serverPort, err := frp.GetFRPServerPort("http://" + lowestLatencyIpAddress.Ipv4 + ":" + lowestLatencyIpAddress.ServerPort) - if err != nil { - return nil, err - } - // Create 3 second delay to allow FRP server to start - time.Sleep(1 * time.Second) - // Starts FRP as a client with - proxyPort, err := frp.StartFRPClientForServer(lowestLatencyIpAddress.Ipv4, serverPort, config.ServerPort, "") - if err != nil { - return nil, err - } + table, err := p2p.ReadIpTable() - // updating with the current proxy address - ProxyIpAddr.Ipv4 = lowestLatencyIpAddress.Ipv4 - ProxyIpAddr.ServerPort = proxyPort - ProxyIpAddr.Name = config.MachineName - ProxyIpAddr.NAT = "False" - ProxyIpAddr.ProxyServer = "False" - ProxyIpAddr.EscapeImplementation = "FRP" + // TODO check if IPV6 or Proxy port is specified + // if not update current entry as proxy address + // with appropriate port on IP Table + if config.BehindNAT == "True" { + if err != nil { + return nil, err + } - if config.BareMetal == "True" { - _, SSHPort, err := MapPort("22", "") - if err != nil { - return nil, err - } - ProxyIpAddr.BareMetalSSHPort = SSHPort - } + var lowestLatency int64 + // random large number + lowestLatency = 10000000 - //ProxyIpAddr.CustomInformationKey = p2p.GenerateHashSHA256(config.IPTableKey) + for i, _ := range table.IpAddress { + // Checks if the ping is the lowest and if the following node is acting as a proxy + //if table.IpAddress[i].Latency.Milliseconds() < lowestLatency && table.IpAddress[i].ProxyPort != "" { + if table.IpAddress[i].Latency.Milliseconds() < lowestLatency && table.IpAddress[i].NAT != "" { + lowestLatency = table.IpAddress[i].Latency.Milliseconds() + lowestLatencyIpAddress = table.IpAddress[i] + } + } - // append the following to the ip table - table.IpAddress = append(table.IpAddress, ProxyIpAddr) - // write information back to the IP Table - } + // If there is an identified node + if lowestLatency != 10000000 { + serverPort, err := frp.GetFRPServerPort("http://" + lowestLatencyIpAddress.Ipv4 + ":" + lowestLatencyIpAddress.ServerPort) + if err != nil { + return nil, err + } + // Create 3 second delay to allow FRP server to start + time.Sleep(1 * time.Second) + // Starts FRP as a client with + proxyPort, err := frp.StartFRPClientForServer(lowestLatencyIpAddress.Ipv4, serverPort, config.ServerPort, "") + if err != nil { + return nil, err + } - } else { - ProxyIpAddr.Ipv4, err = p2p.CurrentPublicIP() - if err != nil { - fmt.Println(err) - } - ProxyIpAddr.ServerPort = config.ServerPort - ProxyIpAddr.Name = config.MachineName - ProxyIpAddr.NAT = "False" - if config.ProxyPort != "" { - ProxyIpAddr.ProxyServer = "True" - } - ProxyIpAddr.EscapeImplementation = "" - if config.BareMetal == "True" { - ProxyIpAddr.BareMetalSSHPort = "22" - } + // updating with the current proxy address + ProxyIpAddr.Ipv4 = lowestLatencyIpAddress.Ipv4 + ProxyIpAddr.ServerPort = proxyPort + ProxyIpAddr.Name = config.MachineName + ProxyIpAddr.NAT = "False" + ProxyIpAddr.ProxyServer = "False" + ProxyIpAddr.EscapeImplementation = "FRP" - table.IpAddress = append(table.IpAddress, ProxyIpAddr) + if config.BareMetal == "True" { + _, SSHPort, err := MapPort("22", "") + if err != nil { + return nil, err + } + ProxyIpAddr.BareMetalSSHPort = SSHPort + } - } + //ProxyIpAddr.CustomInformationKey = p2p.GenerateHashSHA256(config.IPTableKey) - // Writing results to the IPTable - err = table.WriteIpTable() - if err != nil { - return nil, err - } + // append the following to the ip table + table.IpAddress = append(table.IpAddress, ProxyIpAddr) + // write information back to the IP Table + } - // update ip table - go func() error { - err := clientIPTable.UpdateIpTableListClient() - if err != nil { - fmt.Println(err) - return err - } - return nil - }() + } else { + ProxyIpAddr.Ipv4, err = p2p.CurrentPublicIP() + if err != nil { + fmt.Println(err) + } + ProxyIpAddr.ServerPort = config.ServerPort + ProxyIpAddr.Name = config.MachineName + ProxyIpAddr.NAT = "False" + if config.ProxyPort != "" { + ProxyIpAddr.ProxyServer = "True" + } + ProxyIpAddr.EscapeImplementation = "" + if config.BareMetal == "True" { + ProxyIpAddr.BareMetalSSHPort = "22" + } - if config.ProxyPort != "" { - go ProxyRun(config.ProxyPort) - } + table.IpAddress = append(table.IpAddress, ProxyIpAddr) - // Run gin server on the specified port - go r.Run(":" + config.ServerPort) + } - return r, nil + // Writing results to the IPTable + err = table.WriteIpTable() + if err != nil { + return nil, err + } + + // update ip table + go func() error { + err := clientIPTable.UpdateIpTableListClient() + if err != nil { + fmt.Println(err) + return err + } + return nil + }() + + if config.ProxyPort != "" { + go ProxyRun(config.ProxyPort) + } + + // Run gin server on the specified port + go r.Run(":" + config.ServerPort) + + return r, nil } func MapPort(port string, domainName string) (string, string, error) { - //Get Server port based on the config file - config, err := config.ConfigInit(nil, nil) - if err != nil { - return "", "", err - } + //Get Server port based on the config file + config, err := config.ConfigInit(nil, nil) + if err != nil { + return "", "", err + } - // update IPTable with new port and ip address and update ip table - var ProxyIpAddr p2p.IpAddress - var lowestLatencyIpAddress p2p.IpAddress + // update IPTable with new port and ip address and update ip table + var ProxyIpAddr p2p.IpAddress + var lowestLatencyIpAddress p2p.IpAddress - clientIPTable.RemoveOfflineNodes() + clientIPTable.RemoveOfflineNodes() - table, err := p2p.ReadIpTable() - if err != nil { - return "", "", err - } + table, err := p2p.ReadIpTable() + if err != nil { + return "", "", err + } - var lowestLatency int64 - // random large number - lowestLatency = 10000000 + var lowestLatency int64 + // random large number + lowestLatency = 10000000 - for i, _ := range table.IpAddress { - // Checks if the ping is the lowest and if the following node is acting as a proxy - //if table.IpAddress[i].Latency.Milliseconds() < lowestLatency && table.IpAddress[i].ProxyPort != "" { - if table.IpAddress[i].Latency.Milliseconds() < lowestLatency && table.IpAddress[i].NAT != "" { - // Filter based on nodes with proxy enabled - if domainName != "" && table.IpAddress[i].ProxyServer == "Yes" { - lowestLatency = table.IpAddress[i].Latency.Milliseconds() - lowestLatencyIpAddress = table.IpAddress[i] - continue - } - lowestLatency = table.IpAddress[i].Latency.Milliseconds() - lowestLatencyIpAddress = table.IpAddress[i] - } - } + for i, _ := range table.IpAddress { + // Checks if the ping is the lowest and if the following node is acting as a proxy + //if table.IpAddress[i].Latency.Milliseconds() < lowestLatency && table.IpAddress[i].ProxyPort != "" { + if table.IpAddress[i].Latency.Milliseconds() < lowestLatency && table.IpAddress[i].NAT != "" { + // Filter based on nodes with proxy enabled + if domainName != "" && table.IpAddress[i].ProxyServer == "Yes" { + lowestLatency = table.IpAddress[i].Latency.Milliseconds() + lowestLatencyIpAddress = table.IpAddress[i] + continue + } + lowestLatency = table.IpAddress[i].Latency.Milliseconds() + lowestLatencyIpAddress = table.IpAddress[i] + } + } - // If there is an identified node - if lowestLatency != 10000000 { - serverPort, err := frp.GetFRPServerPort("http://" + lowestLatencyIpAddress.Ipv4 + ":" + lowestLatencyIpAddress.ServerPort) - if err != nil { - return "", "", err - } - // Create 3 second delay to allow FRP server to start - time.Sleep(1 * time.Second) - // Starts FRP as a client with - proxyPort, err := frp.StartFRPClientForServer(lowestLatencyIpAddress.Ipv4, serverPort, port, "") - if err != nil { - return "", "", err - } + // If there is an identified node + if lowestLatency != 10000000 { + serverPort, err := frp.GetFRPServerPort("http://" + lowestLatencyIpAddress.Ipv4 + ":" + lowestLatencyIpAddress.ServerPort) + if err != nil { + return "", "", err + } + // Create 3 second delay to allow FRP server to start + time.Sleep(1 * time.Second) + // Starts FRP as a client with + proxyPort, err := frp.StartFRPClientForServer(lowestLatencyIpAddress.Ipv4, serverPort, port, "") + if err != nil { + return "", "", err + } - fmt.Println(domainName) + fmt.Println(domainName) - // Doing the proxy mapping for the domain name - if domainName != "" { - SaveRegistration(domainName, lowestLatencyIpAddress.Ipv4+":"+proxyPort) - } + // Doing the proxy mapping for the domain name + if domainName != "" { + URL := "http://" + lowestLatencyIpAddress.Ipv4 + ":" + proxyPort + "/AddProxy?port=" + port + "&domain_name=" + domainName + "&ip_address=" + lowestLatencyIpAddress.Ipv4 + //} else { + // URL = "http://" + IP + ":" + serverPort + "/server_info" + //} + http.Get(URL) + //SaveRegistration(domainName, lowestLatencyIpAddress.Ipv4+":"+proxyPort) + } - // updating with the current proxy address - ProxyIpAddr.Ipv4 = lowestLatencyIpAddress.Ipv4 - ProxyIpAddr.ServerPort = proxyPort - ProxyIpAddr.Name = config.MachineName - ProxyIpAddr.NAT = "False" - ProxyIpAddr.EscapeImplementation = "FRP" - //ProxyIpAddr.CustomInformationKey = p2p.GenerateHashSHA256(config.IPTableKey) - } else { - return "", "", errors.New("proxy IP not found") - } + // updating with the current proxy address + ProxyIpAddr.Ipv4 = lowestLatencyIpAddress.Ipv4 + ProxyIpAddr.ServerPort = proxyPort + ProxyIpAddr.Name = config.MachineName + ProxyIpAddr.NAT = "False" + ProxyIpAddr.EscapeImplementation = "FRP" + //ProxyIpAddr.CustomInformationKey = p2p.GenerateHashSHA256(config.IPTableKey) + } else { + return "", "", errors.New("proxy IP not found") + } - return ProxyIpAddr.Ipv4 + ":" + ProxyIpAddr.ServerPort, ProxyIpAddr.ServerPort, nil + return ProxyIpAddr.Ipv4 + ":" + ProxyIpAddr.ServerPort, ProxyIpAddr.ServerPort, nil } From dabba147415f36d9f207a6b40f6b53103afa49b2 Mon Sep 17 00:00:00 2001 From: Akilan Date: Fri, 23 Aug 2024 04:18:28 +0100 Subject: [PATCH 14/18] changes --- server/server.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/server/server.go b/server/server.go index 7595e1a..9a02540 100644 --- a/server/server.go +++ b/server/server.go @@ -210,7 +210,10 @@ func Server() (*gin.Engine, error) { " do ensure domain_name, ip_Address and port no is provided")) } - SaveRegistration(DomainName, ip_address+":"+Ports) + err := SaveRegistration(DomainName, ip_address+":"+Ports) + if err != nil { + c.String(http.StatusInternalServerError, fmt.Sprintf(err.Error())) + } //_, ok := ReverseProxies[DomainName] //// To check if the subdomain entry exists @@ -221,6 +224,7 @@ func Server() (*gin.Engine, error) { // //// added proxy as a map entry //ReverseProxies[DomainName] = ReverseProxy{IPAddress: ip_address, Port: Ports} + c.String(http.StatusOK, "Sucess") }) @@ -373,12 +377,14 @@ func MapPort(port string, domainName string) (string, string, error) { // random large number lowestLatency = 10000000 + fmt.Println("here --------------------------------") + for i, _ := range table.IpAddress { // Checks if the ping is the lowest and if the following node is acting as a proxy //if table.IpAddress[i].Latency.Milliseconds() < lowestLatency && table.IpAddress[i].ProxyPort != "" { if table.IpAddress[i].Latency.Milliseconds() < lowestLatency && table.IpAddress[i].NAT != "" { // Filter based on nodes with proxy enabled - if domainName != "" && table.IpAddress[i].ProxyServer == "Yes" { + if domainName != "" && table.IpAddress[i].ProxyServer == "True" { lowestLatency = table.IpAddress[i].Latency.Milliseconds() lowestLatencyIpAddress = table.IpAddress[i] continue @@ -406,6 +412,8 @@ func MapPort(port string, domainName string) (string, string, error) { // Doing the proxy mapping for the domain name if domainName != "" { + fmt.Println("called --------------------------------") + fmt.Println("http://" + lowestLatencyIpAddress.Ipv4 + ":" + proxyPort + "/AddProxy?port=" + port + "&domain_name=" + domainName + "&ip_address=" + lowestLatencyIpAddress.Ipv4) URL := "http://" + lowestLatencyIpAddress.Ipv4 + ":" + proxyPort + "/AddProxy?port=" + port + "&domain_name=" + domainName + "&ip_address=" + lowestLatencyIpAddress.Ipv4 //} else { // URL = "http://" + IP + ":" + serverPort + "/server_info" From ecd6b0cbf3f8d4bc190e66efd5b56eb867e45c0f Mon Sep 17 00:00:00 2001 From: Akilan Date: Fri, 23 Aug 2024 04:20:12 +0100 Subject: [PATCH 15/18] changes --- server/ReverseProxy.go | 145 ++++++++++++++++++++--------------------- 1 file changed, 72 insertions(+), 73 deletions(-) diff --git a/server/ReverseProxy.go b/server/ReverseProxy.go index 2d567db..93982a8 100644 --- a/server/ReverseProxy.go +++ b/server/ReverseProxy.go @@ -2,37 +2,36 @@ package server import ( - "errors" - "fmt" - "github.com/Akilan1999/p2p-rendering-computation/config" - "github.com/gin-gonic/gin" - "log" - "net/http" - "net/http/httputil" - "net/url" + "fmt" + "github.com/Akilan1999/p2p-rendering-computation/config" + "github.com/gin-gonic/gin" + "log" + "net/http" + "net/http/httputil" + "net/url" ) var ( - //RunPort = 2002 // The server port to run on - //ReverseServerAddr = fmt.Sprint("0.0.0.0:", RunPort) // this is our reverse server ip address - //InsideProxyHostname = fmt.Sprint("proxy:", RunPort) // Requests from private network - //OutsideProxyHostname = fmt.Sprint("registration.localhost:", RunPort) // Requests from public network - KnownAddresses = map[string]string{} // Known Addresses + //RunPort = 2002 // The server port to run on + //ReverseServerAddr = fmt.Sprint("0.0.0.0:", RunPort) // this is our reverse server ip address + //InsideProxyHostname = fmt.Sprint("proxy:", RunPort) // Requests from private network + //OutsideProxyHostname = fmt.Sprint("registration.localhost:", RunPort) // Requests from public network + KnownAddresses = map[string]string{} // Known Addresses ) type RegistrationRequest struct { - OutsideHost string // Outside host address. The hostname or IP on the public network. For example foo.bar.com or foo.localhost - InsideHost string // Inside host address. The hostname or IP on the internal network. For example 192.168.10.5 + OutsideHost string // Outside host address. The hostname or IP on the public network. For example foo.bar.com or foo.localhost + InsideHost string // Inside host address. The hostname or IP on the internal network. For example 192.168.10.5 } // This function checks if TLS was enabled on the request // and translates it to the proper scheme (http or https) func GetScheme(c *gin.Context) string { - if c.Request.TLS != nil { - return "https" - } else { - return "http" - } + if c.Request.TLS != nil { + return "https" + } else { + return "http" + } } // IsRegistrationRequest checks if an incoming request is meant to register @@ -65,17 +64,17 @@ func GetScheme(c *gin.Context) string { // SaveRegistration Creates registration of proxy node func SaveRegistration(OutsideHost string, InsideHost string) error { - _, ok := KnownAddresses[OutsideHost] - if !ok { - return errors.New("domain name provided already exists") - } - KnownAddresses[OutsideHost] = InsideHost + //_, ok := KnownAddresses[OutsideHost] + //if !ok { + // return errors.New("domain name provided already exists") + //} + KnownAddresses[OutsideHost] = InsideHost - fmt.Println(OutsideHost) - fmt.Println(InsideHost) - fmt.Println(KnownAddresses[OutsideHost]) + fmt.Println(OutsideHost) + fmt.Println(InsideHost) + fmt.Println(KnownAddresses[OutsideHost]) - return nil + return nil } // Proxy runs the actual proxy and will look at the @@ -84,65 +83,65 @@ func SaveRegistration(OutsideHost string, InsideHost string) error { // request func Proxy(c *gin.Context) { - // Get if HTTP or HTTPS - scheme := GetScheme(c) + // Get if HTTP or HTTPS + scheme := GetScheme(c) - log.Println(scheme, c.Request.Host, c.Request.URL.String()) + log.Println(scheme, c.Request.Host, c.Request.URL.String()) - // Translate the outside hostname to the inside hostname - forwardTo, ok := KnownAddresses[c.Request.Host] + // Translate the outside hostname to the inside hostname + forwardTo, ok := KnownAddresses[c.Request.Host] - if !ok { - log.Printf("Unkown Host: %v", c.Request.Host) - c.String(400, "Unkown Host") - return - } + if !ok { + log.Printf("Unkown Host: %v", c.Request.Host) + c.String(400, "Unkown Host") + return + } - rUrl := fmt.Sprintf("%v://%v%v", scheme, forwardTo, c.Request.URL) + rUrl := fmt.Sprintf("%v://%v%v", scheme, forwardTo, c.Request.URL) - remote, err := url.Parse(rUrl) + remote, err := url.Parse(rUrl) - if err != nil { - log.Println(err) - c.String(500, "Error Proxying Host") - return - } + if err != nil { + log.Println(err) + c.String(500, "Error Proxying Host") + return + } - log.Println("Forwarding request to", remote) + log.Println("Forwarding request to", remote) - // Forward the request to the inside remote server - // https://pkg.go.dev/net/http/httputil#NewSingleHostReverseProxy - proxy := httputil.NewSingleHostReverseProxy(remote) + // Forward the request to the inside remote server + // https://pkg.go.dev/net/http/httputil#NewSingleHostReverseProxy + proxy := httputil.NewSingleHostReverseProxy(remote) - // Director is a function which modifies - // the request into a new request to be sent - // https://pkg.go.dev/net/http/httputil#ReverseProxy - proxy.Director = func(req *http.Request) { - req.Header = c.Request.Header - req.Host = remote.Host - req.URL.Scheme = remote.Scheme - req.URL.Host = remote.Host - req.URL.Path = c.Param("path") - } + // Director is a function which modifies + // the request into a new request to be sent + // https://pkg.go.dev/net/http/httputil#ReverseProxy + proxy.Director = func(req *http.Request) { + req.Header = c.Request.Header + req.Host = remote.Host + req.URL.Scheme = remote.Scheme + req.URL.Host = remote.Host + req.URL.Path = c.Param("path") + } - proxy.ServeHTTP(c.Writer, c.Request) + proxy.ServeHTTP(c.Writer, c.Request) } func ProxyRun(port string) { - r := gin.Default() + r := gin.Default() - KnownAddresses = make(map[string]string) + KnownAddresses = make(map[string]string) - // Get config information - Config, err := config.ConfigInit(nil, nil) - if err != nil { - log.Printf("Error: %v", err) - } + // Get config information + Config, err := config.ConfigInit(nil, nil) + if err != nil { + log.Printf("Error: %v", err) + } - // all paths should be handled by Proxy() - r.Any("/*path", Proxy) + // all paths should be handled by Proxy() + r.Any("/*path", Proxy) - if err := r.RunTLS(fmt.Sprint("0.0.0.0:", port), Config.PemFile, Config.KeyFile); err != nil { - log.Printf("Error: %v", err) - } + if err := r.RunTLS(fmt.Sprint("0.0.0.0:", port), Config.PemFile, Config.KeyFile); err != nil { + log.Printf("Error: %v", err) + } } From 00317008a263ef58844c1067646a3c42387d4866 Mon Sep 17 00:00:00 2001 From: Akilan Date: Fri, 23 Aug 2024 04:24:43 +0100 Subject: [PATCH 16/18] fixes --- server/ReverseProxy.go | 144 ++++++++++++++++++++--------------------- server/server.go | 4 +- 2 files changed, 74 insertions(+), 74 deletions(-) diff --git a/server/ReverseProxy.go b/server/ReverseProxy.go index 93982a8..87b4dff 100644 --- a/server/ReverseProxy.go +++ b/server/ReverseProxy.go @@ -2,36 +2,36 @@ package server import ( - "fmt" - "github.com/Akilan1999/p2p-rendering-computation/config" - "github.com/gin-gonic/gin" - "log" - "net/http" - "net/http/httputil" - "net/url" + "fmt" + "github.com/Akilan1999/p2p-rendering-computation/config" + "github.com/gin-gonic/gin" + "log" + "net/http" + "net/http/httputil" + "net/url" ) var ( - //RunPort = 2002 // The server port to run on - //ReverseServerAddr = fmt.Sprint("0.0.0.0:", RunPort) // this is our reverse server ip address - //InsideProxyHostname = fmt.Sprint("proxy:", RunPort) // Requests from private network - //OutsideProxyHostname = fmt.Sprint("registration.localhost:", RunPort) // Requests from public network - KnownAddresses = map[string]string{} // Known Addresses + //RunPort = 2002 // The server port to run on + //ReverseServerAddr = fmt.Sprint("0.0.0.0:", RunPort) // this is our reverse server ip address + //InsideProxyHostname = fmt.Sprint("proxy:", RunPort) // Requests from private network + //OutsideProxyHostname = fmt.Sprint("registration.localhost:", RunPort) // Requests from public network + KnownAddresses = map[string]string{} // Known Addresses ) type RegistrationRequest struct { - OutsideHost string // Outside host address. The hostname or IP on the public network. For example foo.bar.com or foo.localhost - InsideHost string // Inside host address. The hostname or IP on the internal network. For example 192.168.10.5 + OutsideHost string // Outside host address. The hostname or IP on the public network. For example foo.bar.com or foo.localhost + InsideHost string // Inside host address. The hostname or IP on the internal network. For example 192.168.10.5 } // This function checks if TLS was enabled on the request // and translates it to the proper scheme (http or https) func GetScheme(c *gin.Context) string { - if c.Request.TLS != nil { - return "https" - } else { - return "http" - } + if c.Request.TLS != nil { + return "https" + } else { + return "http" + } } // IsRegistrationRequest checks if an incoming request is meant to register @@ -64,17 +64,17 @@ func GetScheme(c *gin.Context) string { // SaveRegistration Creates registration of proxy node func SaveRegistration(OutsideHost string, InsideHost string) error { - //_, ok := KnownAddresses[OutsideHost] - //if !ok { - // return errors.New("domain name provided already exists") - //} - KnownAddresses[OutsideHost] = InsideHost + //_, ok := KnownAddresses[OutsideHost] + //if !ok { + // return errors.New("domain name provided already exists") + //} + KnownAddresses[OutsideHost] = InsideHost - fmt.Println(OutsideHost) - fmt.Println(InsideHost) - fmt.Println(KnownAddresses[OutsideHost]) + fmt.Println(OutsideHost) + fmt.Println(InsideHost) + fmt.Println(KnownAddresses[OutsideHost]) - return nil + return nil } // Proxy runs the actual proxy and will look at the @@ -83,65 +83,65 @@ func SaveRegistration(OutsideHost string, InsideHost string) error { // request func Proxy(c *gin.Context) { - // Get if HTTP or HTTPS - scheme := GetScheme(c) + // Get if HTTP or HTTPS + scheme := GetScheme(c) - log.Println(scheme, c.Request.Host, c.Request.URL.String()) + log.Println(scheme, c.Request.Host, c.Request.URL.String()) - // Translate the outside hostname to the inside hostname - forwardTo, ok := KnownAddresses[c.Request.Host] + // Translate the outside hostname to the inside hostname + forwardTo, ok := KnownAddresses[c.Request.Host] - if !ok { - log.Printf("Unkown Host: %v", c.Request.Host) - c.String(400, "Unkown Host") - return - } + if !ok { + log.Printf("Unkown Host: %v", c.Request.Host) + c.String(400, "Unkown Host") + return + } - rUrl := fmt.Sprintf("%v://%v%v", scheme, forwardTo, c.Request.URL) + rUrl := fmt.Sprintf("%v://%v%v", scheme, forwardTo, c.Request.URL) - remote, err := url.Parse(rUrl) + remote, err := url.Parse(rUrl) - if err != nil { - log.Println(err) - c.String(500, "Error Proxying Host") - return - } + if err != nil { + log.Println(err) + c.String(500, "Error Proxying Host") + return + } - log.Println("Forwarding request to", remote) + log.Println("Forwarding request to", remote) - // Forward the request to the inside remote server - // https://pkg.go.dev/net/http/httputil#NewSingleHostReverseProxy - proxy := httputil.NewSingleHostReverseProxy(remote) + // Forward the request to the inside remote server + // https://pkg.go.dev/net/http/httputil#NewSingleHostReverseProxy + proxy := httputil.NewSingleHostReverseProxy(remote) - // Director is a function which modifies - // the request into a new request to be sent - // https://pkg.go.dev/net/http/httputil#ReverseProxy - proxy.Director = func(req *http.Request) { - req.Header = c.Request.Header - req.Host = remote.Host - req.URL.Scheme = remote.Scheme - req.URL.Host = remote.Host - req.URL.Path = c.Param("path") - } + // Director is a function which modifies + // the request into a new request to be sent + // https://pkg.go.dev/net/http/httputil#ReverseProxy + proxy.Director = func(req *http.Request) { + req.Header = c.Request.Header + req.Host = remote.Host + req.URL.Scheme = remote.Scheme + req.URL.Host = remote.Host + req.URL.Path = c.Param("path") + } - proxy.ServeHTTP(c.Writer, c.Request) + proxy.ServeHTTP(c.Writer, c.Request) } func ProxyRun(port string) { - r := gin.Default() + r := gin.Default() - KnownAddresses = make(map[string]string) + KnownAddresses = make(map[string]string) - // Get config information - Config, err := config.ConfigInit(nil, nil) - if err != nil { - log.Printf("Error: %v", err) - } + // Get config information + Config, err := config.ConfigInit(nil, nil) + if err != nil { + log.Printf("Error: %v", err) + } - // all paths should be handled by Proxy() - r.Any("/*path", Proxy) + // all paths should be handled by Proxy() + r.Any("/*path", Proxy) - if err := r.RunTLS(fmt.Sprint("0.0.0.0:", port), Config.PemFile, Config.KeyFile); err != nil { - log.Printf("Error: %v", err) - } + if err := r.RunTLS(fmt.Sprint("0.0.0.0:", port), Config.PemFile, Config.KeyFile); err != nil { + log.Printf("Error: %v", err) + } } diff --git a/server/server.go b/server/server.go index 9a02540..f2eea43 100644 --- a/server/server.go +++ b/server/server.go @@ -413,8 +413,8 @@ func MapPort(port string, domainName string) (string, string, error) { // Doing the proxy mapping for the domain name if domainName != "" { fmt.Println("called --------------------------------") - fmt.Println("http://" + lowestLatencyIpAddress.Ipv4 + ":" + proxyPort + "/AddProxy?port=" + port + "&domain_name=" + domainName + "&ip_address=" + lowestLatencyIpAddress.Ipv4) - URL := "http://" + lowestLatencyIpAddress.Ipv4 + ":" + proxyPort + "/AddProxy?port=" + port + "&domain_name=" + domainName + "&ip_address=" + lowestLatencyIpAddress.Ipv4 + fmt.Println("http://" + lowestLatencyIpAddress.Ipv4 + ":" + lowestLatencyIpAddress.ServerPort + "/AddProxy?port=" + proxyPort + "&domain_name=" + domainName + "&ip_address=" + lowestLatencyIpAddress.Ipv4) + URL := "http://" + lowestLatencyIpAddress.Ipv4 + ":" + lowestLatencyIpAddress.ServerPort + "/AddProxy?port=" + proxyPort + "&domain_name=" + domainName + "&ip_address=" + lowestLatencyIpAddress.Ipv4 //} else { // URL = "http://" + IP + ":" + serverPort + "/server_info" //} From 0a1332755146314b71c98e5d661a7b54a4d5abb0 Mon Sep 17 00:00:00 2001 From: Akilan Date: Fri, 23 Aug 2024 04:32:59 +0100 Subject: [PATCH 17/18] enabled TLS --- p2p/frp/client.go | 11 ++++++++++- server/server.go | 2 -- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/p2p/frp/client.go b/p2p/frp/client.go index 75ae6f7..54aa07b 100644 --- a/p2p/frp/client.go +++ b/p2p/frp/client.go @@ -1,13 +1,14 @@ package frp import ( + defaultConfig "github.com/Akilan1999/p2p-rendering-computation/config" "github.com/Akilan1999/p2p-rendering-computation/server/docker" "github.com/fatedier/frp/client" "github.com/fatedier/frp/pkg/config" + "github.com/phayes/freeport" "math/rand" "strconv" "time" - "github.com/phayes/freeport" ) // Client This struct stores @@ -144,6 +145,11 @@ func (c *Client) StartFRPClient() error { cfg := config.GetDefaultClientConf() + Config, err := defaultConfig.ConfigInit(nil, nil) + if err != nil { + return err + } + var proxyConfs map[string]config.ProxyConf var visitorCfgs map[string]config.VisitorConf @@ -151,6 +157,9 @@ func (c *Client) StartFRPClient() error { cfg.ServerAddr = c.Server.address cfg.ServerPort = c.Server.port + cfg.TLSEnable = true + cfg.TLSKeyFile = Config.KeyFile + cfg.TLSCertFile = Config.PemFile for i, _ := range c.ClientMappings { var tcpcnf config.TCPProxyConf diff --git a/server/server.go b/server/server.go index f2eea43..8140e48 100644 --- a/server/server.go +++ b/server/server.go @@ -377,8 +377,6 @@ func MapPort(port string, domainName string) (string, string, error) { // random large number lowestLatency = 10000000 - fmt.Println("here --------------------------------") - for i, _ := range table.IpAddress { // Checks if the ping is the lowest and if the following node is acting as a proxy //if table.IpAddress[i].Latency.Milliseconds() < lowestLatency && table.IpAddress[i].ProxyPort != "" { From 5a5985a5736b82d537affb879fcebb6a6efc2e87 Mon Sep 17 00:00:00 2001 From: Akilan Date: Fri, 23 Aug 2024 04:38:17 +0100 Subject: [PATCH 18/18] enabled TLS --- p2p/frp/client.go | 15 +++++++-------- server/ReverseProxy.go | 2 +- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/p2p/frp/client.go b/p2p/frp/client.go index 54aa07b..adabd37 100644 --- a/p2p/frp/client.go +++ b/p2p/frp/client.go @@ -1,7 +1,6 @@ package frp import ( - defaultConfig "github.com/Akilan1999/p2p-rendering-computation/config" "github.com/Akilan1999/p2p-rendering-computation/server/docker" "github.com/fatedier/frp/client" "github.com/fatedier/frp/pkg/config" @@ -145,10 +144,10 @@ func (c *Client) StartFRPClient() error { cfg := config.GetDefaultClientConf() - Config, err := defaultConfig.ConfigInit(nil, nil) - if err != nil { - return err - } + //Config, err := defaultConfig.ConfigInit(nil, nil) + //if err != nil { + // return err + //} var proxyConfs map[string]config.ProxyConf var visitorCfgs map[string]config.VisitorConf @@ -157,9 +156,9 @@ func (c *Client) StartFRPClient() error { cfg.ServerAddr = c.Server.address cfg.ServerPort = c.Server.port - cfg.TLSEnable = true - cfg.TLSKeyFile = Config.KeyFile - cfg.TLSCertFile = Config.PemFile + //cfg.TLSEnable = true + //cfg.TLSKeyFile = Config.KeyFile + //cfg.TLSCertFile = Config.PemFile for i, _ := range c.ClientMappings { var tcpcnf config.TCPProxyConf diff --git a/server/ReverseProxy.go b/server/ReverseProxy.go index 87b4dff..7b715b4 100644 --- a/server/ReverseProxy.go +++ b/server/ReverseProxy.go @@ -97,7 +97,7 @@ func Proxy(c *gin.Context) { return } - rUrl := fmt.Sprintf("%v://%v%v", scheme, forwardTo, c.Request.URL) + rUrl := fmt.Sprintf("%v://%v%v", "http", forwardTo, c.Request.URL) remote, err := url.Parse(rUrl)