Files
p2p-rendering-computation/p2p/docs.md

10 KiB
Raw Permalink Blame History

p2p

import "github.com/Akilan1999/p2p-rendering-computation/p2p"

Index

func AddAuthorisationKey

func AddAuthorisationKey(PublicKey string) error

AddAuthorisationKey Adds public key provided to the authorization file so that nodes can SSH into the

func AddKeyToAuthorizedKeys

func AddKeyToAuthorizedKeys(path, newKey string) error

AddKeyToAuthorizedKeys adds a new key to the authorized_keys file if it doesnt already exist

func CurrentPublicIP

func CurrentPublicIP() (string, error)

CurrentPublicIP Get Current Public IP address

func ForwardPort

func ForwardPort(port int) error

Port forwarding to the router

func GenerateHashSHA256

func GenerateHashSHA256(text string) []byte

func GetAuthorizedKeysPath

func GetAuthorizedKeysPath() (string, error)

GetAuthorizedKeysPath returns the path to the authorized_keys file

func GetCurrentIPV6

func GetCurrentIPV6() (string, error)

GetCurrentIPV6 gets the current IPV6 address based on the interface specified in the config file

func Ip4or6

func Ip4or6(s string) string

Ip4or6 Helper function to check if the IP address is IPV4 or IPV6 (https://socketloop.com/tutorials/golang-check-if-ip-address-is-version-4-or-6)

func LocalSpeedTestIpTable

func LocalSpeedTestIpTable() error

LocalSpeedTestIpTable Runs speed test in iptables locally only

func PrettyPrint

func PrettyPrint(data interface{})

func PrintIpTable

func PrintIpTable() error

PrintIpTable Print Ip table data for Cli

func ReadAuthorizedKeys

func ReadAuthorizedKeys(path string) (map[string]bool, error)

ReadAuthorizedKeys reads and returns the current contents of the authorized_keys file as a map

func RemoveKeyFromAuthorizedKeys

func RemoveKeyFromAuthorizedKeys(path, keyToRemove string) error

func UnForwardPort

func UnForwardPort(port int) error

UnForwardPort from router

func ValidateHashSHA256

func ValidateHashSHA256(text string, Hash []byte) bool

ValidateHashSHA256 CustomInformationKey the text and check if the text and the hash are the same, if they are then return true SHA256 is the current hashing algorthm used.

func ViewNetworkInterface

func ViewNetworkInterface() error

ViewNetworkInterface This function is created to view the network interfaces available

type IP

type IP struct {
    Query string
}

type IpAddress

type IpAddress struct {
    Name                 string        `json:"Name"`
    MachineUsername      string        `json:"MachineUsername"`
    Ipv4                 string        `json:"IPV4"`
    Ipv6                 string        `json:"IPV6"`
    Latency              time.Duration `json:"Latency"`
    Download             float64       `json:"Download"`
    Upload               float64       `json:"Upload"`
    ServerPort           string        `json:"ServerPort"`
    BareMetalSSHPort     string        `json:"BareMetalSSHPort"`
    NAT                  string        `json:"NAT"`
    EscapeImplementation string        `json:"EscapeImplementation"`
    ProxyServer          string        `json:"ProxyServer"`
    UnSafeMode           bool          `json:"UnSafeMode"`
    PublicKey            string        `json:"PublicKey"`
    CustomInformation    string        `json:"CustomInformation"`
}

func (*IpAddress) DownloadSpeed

func (s *IpAddress) DownloadSpeed() error

Download Speed

func (*IpAddress) PingTest

func (s *IpAddress) PingTest() error

PingTest executes test to measure latency

func (*IpAddress) UploadSpeed

func (s *IpAddress) UploadSpeed() error

type IpAddresses

type IpAddresses struct {
    IpAddress []IpAddress `json:"ip_address"`
}

func ReadIpTable

func ReadIpTable() (*IpAddresses, error)

ReadIpTable Read data from Ip tables from json file

func (*IpAddresses) RemoveDuplicates

func (table *IpAddresses) RemoveDuplicates() error

RemoveDuplicates This is a temporary fix current functions failing to remove Duplicate IP addresses from local IP table

func (*IpAddresses) SpeedTest

func (ip *IpAddresses) SpeedTest() error

SpeedTest Runs a speed test and does updates IP tables accordingly

func (*IpAddresses) SpeedTestUpdatedIPTable

func (ip *IpAddresses) SpeedTestUpdatedIPTable() error

SpeedTestUpdatedIPTable Called when ip tables from httpclient/server is also passed on

func (*IpAddresses) WriteIpTable

func (i *IpAddresses) WriteIpTable() error

WriteIpTable Write to IP table json file

Generated by gomarkdoc