fixed pass through custom information
This commit is contained in:
@@ -31,9 +31,11 @@ P2PRC_instances() {
|
||||
p2prc --as 0.0.0.0 -p "$NEW_PORT"
|
||||
|
||||
# Replace the ServerPort in config
|
||||
# test-$counter
|
||||
sed -i.bak "s/\"ServerPort\": \"[0-9]*\"/\"ServerPort\": \"$NEW_PORT\"/" "./config.json"
|
||||
sed -i.bak "s/\"Test\": false/\"Test\": true/" "./config.json"
|
||||
sed -i.bak "s/\"BehindNAT\": true/\"BehindNAT\": false/" "./config.json"
|
||||
# sed -i.bak "s/\"MachineName\": "Akilans-MacBook-Pro.local-J2UbbkF"/\"MachineName\": \"test-$counter\"/" "./config.json"
|
||||
|
||||
cat config.json
|
||||
|
||||
@@ -92,6 +94,15 @@ Update_All_IP_Tables() {
|
||||
done
|
||||
}
|
||||
|
||||
# Test function for the root to custom information
|
||||
# through the network
|
||||
Send_Information() {
|
||||
ls
|
||||
cd test-2/
|
||||
p2prc --amd "test message"
|
||||
cd ..
|
||||
}
|
||||
|
||||
|
||||
# ---------------- Work flow test ---------------
|
||||
|
||||
@@ -104,6 +115,12 @@ P2PRC_instances 3
|
||||
## Start instances
|
||||
Start_all_instances 3
|
||||
|
||||
|
||||
# Send test information from node 1
|
||||
sleep 10
|
||||
Send_Information
|
||||
|
||||
sleep 10
|
||||
## List ip tables of nodes started
|
||||
IP_Tables_after_Started 3
|
||||
#
|
||||
@@ -112,3 +129,4 @@ Remove_all_test_files
|
||||
|
||||
## Kill all instances
|
||||
Kill_all_instances
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ func AddCustomInformationToIPTable(text string) error {
|
||||
if found {
|
||||
table.WriteIpTable()
|
||||
// update IPTable after modified entry
|
||||
go UpdateIpTableListClient()
|
||||
UpdateIpTableListClient()
|
||||
} else {
|
||||
return errors.New("start server with p2prc -s as the server is currently not running")
|
||||
}
|
||||
|
||||
@@ -205,6 +205,7 @@ func CurrentPublicIP() (string, error) {
|
||||
json.Unmarshal(body, &ip)
|
||||
|
||||
return ip.Query, nil
|
||||
|
||||
}
|
||||
|
||||
// GetCurrentIPV6 gets the current IPV6 address based on the interface
|
||||
|
||||
@@ -93,6 +93,7 @@ func (ip *IpAddresses) SpeedTestUpdatedIPTable() error {
|
||||
// and look upon later on.
|
||||
AddAuthorisationKey(ip.IpAddress[k].PublicKey)
|
||||
}
|
||||
targets.IpAddress[i].CustomInformation = ip.IpAddress[k].CustomInformation
|
||||
// Checks if both the IPV4 addresses are the same or the IPV6 address is not
|
||||
// an empty string and IPV6 address are the same
|
||||
if (ip.IpAddress[k].Ipv4 == targets.IpAddress[i].Ipv4 && targets.IpAddress[i].NAT) || (targets.IpAddress[i].Ipv6 != "" && ip.IpAddress[k].Ipv6 == targets.IpAddress[i].Ipv6) {
|
||||
|
||||
@@ -141,8 +141,6 @@ func Server() (*gin.Engine, error) {
|
||||
// Convert Get Request value to int
|
||||
fmt.Sscanf(Ports, "%d", &PortsInt)
|
||||
|
||||
fmt.Println(string(PublicKeyDecoded[:]))
|
||||
|
||||
// Creates container and returns-back result to
|
||||
// access container
|
||||
resp, err := docker.BuildRunContainer(PortsInt, GPU, ContainerName, BaseImage, string(PublicKeyDecoded[:]))
|
||||
|
||||
Reference in New Issue
Block a user