pushed commit for remote map port
This commit is contained in:
@@ -3,21 +3,30 @@ package client
|
||||
import (
|
||||
"github.com/Akilan1999/p2p-rendering-computation/config"
|
||||
"io/ioutil"
|
||||
"net"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
type ResponseMAPPort struct {
|
||||
IPAddress string
|
||||
IPAddress string
|
||||
PortNo string
|
||||
EntireAddress string
|
||||
}
|
||||
|
||||
func MAPPort(port string, domainName string) (*ResponseMAPPort, error) {
|
||||
func MAPPort(port string, domainName string, ServerAddress string) (*ResponseMAPPort, error) {
|
||||
Config, err := config.ConfigInit(nil, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
URL := "http://0.0.0.0:" + Config.ServerPort
|
||||
|
||||
if ServerAddress != "" {
|
||||
URL = "http://" + ServerAddress
|
||||
}
|
||||
|
||||
//if version == "version 6" {
|
||||
URL := "http://0.0.0.0:" + Config.ServerPort + "/MAPPort?port=" + port + "&domain_name=" + domainName
|
||||
URL = URL + "/MAPPort?port=" + port + "&domain_name=" + domainName
|
||||
//} else {
|
||||
// URL = "http://" + IP + ":" + serverPort + "/server_info"
|
||||
//}
|
||||
@@ -32,8 +41,15 @@ func MAPPort(port string, domainName string) (*ResponseMAPPort, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
host, Exposedport, err := net.SplitHostPort(string(byteValue))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var response ResponseMAPPort
|
||||
response.IPAddress = string(byteValue)
|
||||
response.IPAddress = host
|
||||
response.PortNo = Exposedport
|
||||
response.EntireAddress = string(byteValue)
|
||||
|
||||
return &response, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user