util

package
v0.0.0-...-575db3a Latest Latest
Warning

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

Go to latest
Published: May 9, 2017 License: AGPL-3.0 Imports: 26 Imported by: 0

README

In order to avoid import cycles, anything in util MUST be very basic and not call things in higher level packages

If the reference to a higher level package is just to grab a variable, the simple fix is to add a copy in ../util/include.go and have the higher level package copy to that, or simply have the higher level function reference a util..

Bottom line: About the only safe local code in include is github.com/goarchit/archit/log

Documentation

Overview

Code compliments of http://stackoverflow.com/questions/21060945/simple-way-to-copy-a-file-in-golang

Filename manipulation routines initially written on 5/6/17

Hash.go, based the the goarchit/sample/hashfile.go routine Black2B is significantly faster than other hashes for our need Routine is called per 1GB slice and to create an authentication hash for each 32mb encoded slice

Index

Constants

View Source
const FileDBName = "FileInfo.bolt"
View Source
const GB uint64 = 1024 * 1024 * 1024
View Source
const MaxRaptor = 12
View Source
const OutOfHops = "Out of Hops"
View Source
const PeerDBName = "PeerInfo.bolt"
View Source
const SeedPortBase = ":1958"
View Source
const ShardLen = 32 * 1024 * 1024

Variables

View Source
var Account string

Subcommand flags that may be found in the configuration file

View Source
var Chaos bool
View Source
var Conf string

Global command line flags found in ../config/parser.go and likely in the configuration file

View Source
var DBDir string
View Source
var DNSSeeds []string
View Source
var DataDir string
View Source
var DerivedKey []byte
View Source
var FarmerStop chan bool
View Source
var IAmASeed bool
View Source
var KeyPIN int
View Source
var KeyPass string
View Source
var LogFile string
View Source
var LogLevel int
View Source
var Matrix [32 + MaxRaptor][32]int
View Source
var MatrixCount [32 + MaxRaptor]int
View Source
var MinFreeSpace uint64
View Source
var Mutex sync.Mutex
View Source
var MyDNSServerIP string
View Source
var PortBase int
View Source
var PublicIP string
View Source
var Raptor int
View Source
var ResetLog bool
View Source
var SeedMode bool
View Source
var SliceName string
View Source
var Verbose int
View Source
var WalletAddr string
View Source
var WalletIP string
View Source
var WalletPassword string
View Source
var WalletPort int
View Source
var WalletUser string

Functions

func BuildMatrix

func BuildMatrix()

func Challenge

func Challenge()

func CopyFile

func CopyFile(src, dst string) (err error)

CopyFile copies a file from src to dst. If src and dst files exist, and are the same, then return success. Otherise, attempt to create a hard link between the two files. If that fail, copy the file contents from src to dst.

func Dnsseed

func Dnsseed()

func Encode

func Encode(tblock *[(32 + MaxRaptor) * ShardLen]byte, block *[32 * ShardLen]byte, i int)

func Encrypt

func Encrypt(tblock []byte, iv *[32 + MaxRaptor][aes.BlockSize]byte, i int)

func FullPath

func FullPath(path string) string

func GetExtIP

func GetExtIP() string

func GetOutboundIP

func GetOutboundIP() string

function to get the public ip address

func HashString

func HashString(source string) ([]byte, error)

func IsMulticastCapable

func IsMulticastCapable(network string, ifi *net.Interface) (net.IP, bool)

IsMulticastCapable reports whether ifi is an IP multicast-capable network interface. Network must be "ip", "ip4" or "ip6".

func RSACheck

func RSACheck(private, public string) error

func RSAGenerate

func RSAGenerate(private, public string)

func RoutedInterface

func RoutedInterface(network string, flags net.Flags) *net.Interface

RoutedInterface returns a network interface that can route IP traffic and satisfies flags. It returns nil when an appropriate network interface is not found. Network must be "ip", "ip4" or "ip6".

func XorBytes

func XorBytes(dst, b []byte) int

Types

type ByRep

type ByRep []SortedPeer

func SortPl

func SortPl(pl PeerList) ByRep

func (ByRep) Len

func (a ByRep) Len() int

func (ByRep) Less

func (a ByRep) Less(i, j int) bool

func (ByRep) Swap

func (a ByRep) Swap(i, j int)

type Peer

type Peer struct {
	IPAddr     string // including port
	MacAddr    string
	Reputation int64
	PublicKey  string
}

type PeerList

type PeerList map[string]Peer // Indexed by Wallet Address

func GetPeerInfo

func GetPeerInfo(serverIP string) PeerList

type SortedPeer

type SortedPeer struct {
	Reputation int64 // sort key
	WalletAddr string
	IPAddr     string
}

Jump to

Keyboard shortcuts

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