p2p

package
v0.0.0-...-9d99875 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 24, 2021 License: GPL-2.0 Imports: 13 Imported by: 0

README

P2P module
===========
 (Techniques to get over NAT)
  - UPNP implementation
  - DMZ to be used if UPNP does not work
  - Port forwarding for future release

 (Discovery of Nodes)
  - Connect to reliable connection (that has some knowledge)
  - Check if the connection is still open (If not instruct the server to remove from table)
  - According speed tests
  - Send list of servers connection open
  - default 100 MB (to store tables of ip records)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

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 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 PrintIpTable

func PrintIpTable() error

PrintIpTable Print Ip table data for Cli

func UnForwardPort

func UnForwardPort(port int) error

unForwardPort from router

func ViewNetworkInterface

func ViewNetworkInterface() error

ViewNetworkInterface This function is created to view the network interfaces available

Types

type IP

type IP struct {
	Query string
}

type IpAddress

type IpAddress struct {
	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"`
}

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL