lib

package
v0.0.0-...-91c256b Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2020 License: GPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DWrite     = "write"
	DRead      = "read"
	DReadAll   = "readall"
	DBPosition = ".database"
)

Variables

View Source
var DateLayout = "2006-01-02_15-04-05"

date layout

Functions

func DhtQuery

func DhtQuery(cid string) []map[string]interface{}

perform the HTTP dht query command with a timeout of 10 seconds

func GenerateBucketQuery

func GenerateBucketQuery(iterations int, startingCid string) ([256]string, error)

func GetMyCid

func GetMyCid() string

func GraphsServe

func GraphsServe(port string)

func SetGraphDb

func SetGraphDb(db Database)

Types

type Connection

type Connection struct {
	Timestamp string   `json:"timestamp"`
	CidList   []string `json:"cidList"`
}

struct representing a connection data in a specific time

type Connections

type Connections []Connection

func (Connections) Len

func (c Connections) Len() int

func (Connections) Less

func (c Connections) Less(i, j int) bool

func (Connections) Swap

func (c Connections) Swap(i, j int)

type Database

type Database struct {
	// contains filtered or unexported fields
}

struct representing the database, must be a singleton

func (*Database) DbClose

func (db *Database) DbClose()

func (*Database) DbInit

func (db *Database) DbInit()

func (*Database) DbWrite

func (db *Database) DbWrite(collection string, key string, object interface{})

type DhtQueryLog

type DhtQueryLog struct {
	Timestamp        string                  `json:"timestamp"`
	StartingCid      string                  `json:"startingCid"`
	BucketId         int                     `json:"BucketId"`
	DhtRecursionList []DhtQueryRecursionElem `json:"dhtRecursionList"`
}

struct representing the recursion list of the command dht query in a specific moment

func GetDhtQueryRecursionList

func GetDhtQueryRecursionList(cid string, geolocation PeerGeolocation) DhtQueryLog

using dht query ipfs command, try to explore the recursion

type DhtQueryRecursionElem

type DhtQueryRecursionElem struct {
	Peer     Peer   `json:"peer"`
	PeerList []Peer `json:"peerList"`
}

type Peer

type Peer struct {
	Addr    string  `json:"Addr"`
	Cid     string  `json:"Cid"`
	Latency string  `json:"Latency"`
	Nation  string  `json:"Nation"`
	City    string  `json:"City"`
	Lat     float32 `json:"Lat"`
	Lon     float32 `json:"Lon"`
}

struct reperesenting the peer

func SwarmStatusList

func SwarmStatusList() []Peer

using ipfs HTTP api -> gets the list of the current connected peer to the swarm

type PeerGeolocation

type PeerGeolocation struct {
	// contains filtered or unexported fields
}

func (*PeerGeolocation) Init

func (p *PeerGeolocation) Init(ip4dbloc string, ip6dbloc string) error

func (*PeerGeolocation) SetPeerCity

func (p *PeerGeolocation) SetPeerCity(peer *Peer)

Given a peer -> set to the Peer the City and the Country from his ip address

type Query

type Query struct {
	// contains filtered or unexported fields
}

struct representing the query to the database

Jump to

Keyboard shortcuts

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