Documentation ¶
Index ¶
- Constants
- Variables
- func CreateNetMap(entry dht.Entry, db *dht.DHT, currentNodes map[string]bool, ...) ([]MapNode, []MapLink)
- func ExternalIp() string
- func SetupZifTorService(port, tor int, cookie string) (*torc.TorControl, string, error)
- type CommandAddMeta
- type CommandAddPost
- type CommandAddressEncode
- type CommandAnnounce
- type CommandBootstrap
- type CommandFile
- type CommandGetMeta
- type CommandLocalGet
- type CommandLocalSet
- type CommandMeta
- type CommandMirror
- type CommandMirrorProgress
- type CommandNetMap
- type CommandPeer
- type CommandPeerIndex
- type CommandPeerPopular
- type CommandPeerRecent
- type CommandPeerSearch
- type CommandPeers
- type CommandPing
- type CommandRSearch
- type CommandRebuildCollection
- type CommandRequestAddPeer
- type CommandResolve
- type CommandResult
- type CommandSaveCollection
- type CommandSaveRoutingTable
- type CommandSearchEntry
- type CommandSelfIndex
- type CommandSelfPopular
- type CommandSelfRecent
- type CommandSelfSearch
- type CommandServer
- func (cs *CommandServer) AddMeta(cam CommandAddMeta) CommandResult
- func (cs *CommandServer) AddPost(ap CommandAddPost) CommandResult
- func (cs *CommandServer) AddressEncode(ce CommandAddressEncode) CommandResult
- func (cs *CommandServer) Announce(a CommandAnnounce) CommandResult
- func (cs *CommandServer) Bootstrap(cb CommandBootstrap) CommandResult
- func (cs *CommandServer) EntrySearch(ps CommandSearchEntry) CommandResult
- func (cs *CommandServer) Explore() CommandResult
- func (cs *CommandServer) GetMirrorProgress(cmp CommandMirrorProgress) CommandResult
- func (cs *CommandServer) LocalGet(clg CommandLocalGet) CommandResult
- func (cs *CommandServer) LocalSet(cls CommandLocalSet) CommandResult
- func (cs *CommandServer) MemProfile(cf CommandFile) CommandResult
- func (cs *CommandServer) Mirror(cm CommandMirror) CommandResult
- func (cs *CommandServer) NetMap(cnm CommandNetMap) CommandResult
- func (cs *CommandServer) PeerIndex(ci CommandPeerIndex) CommandResult
- func (cs *CommandServer) PeerPopular(pp CommandPeerPopular) CommandResult
- func (cs *CommandServer) PeerRecent(pr CommandPeerRecent) CommandResult
- func (cs *CommandServer) PeerSearch(ps CommandPeerSearch) CommandResult
- func (cs *CommandServer) Peers(cp CommandPeers) CommandResult
- func (cs *CommandServer) Ping(p CommandPing) CommandResult
- func (cs *CommandServer) RSearch(rs CommandRSearch) CommandResult
- func (cs *CommandServer) RebuildCollection(crc CommandRebuildCollection) CommandResult
- func (cs *CommandServer) RequestAddPeer(crap CommandRequestAddPeer) CommandResult
- func (cs *CommandServer) Resolve(cr CommandResolve) CommandResult
- func (cs *CommandServer) SaveCollection(csc CommandSaveCollection) CommandResult
- func (cs *CommandServer) SelfIndex(ci CommandSelfIndex) CommandResult
- func (cs *CommandServer) SelfPopular(cp CommandSelfPopular) CommandResult
- func (cs *CommandServer) SelfRecent(cr CommandSelfRecent) CommandResult
- func (cs *CommandServer) SelfSearch(css CommandSelfSearch) CommandResult
- func (cs *CommandServer) SelfSuggest(css CommandSuggest) CommandResult
- func (cs *CommandServer) SetSeedLeech(csl CommandSetSeedLeech) CommandResult
- func (cs *CommandServer) StartCpuProfile(cf CommandFile) CommandResult
- func (cs *CommandServer) StopCpuProfile() CommandResult
- type CommandSetSeedLeech
- type CommandSuggest
- type HttpServer
- func (hs *HttpServer) AddMeta(w http.ResponseWriter, r *http.Request)
- func (hs *HttpServer) AddPost(w http.ResponseWriter, r *http.Request)
- func (hs *HttpServer) AddressEncode(w http.ResponseWriter, r *http.Request)
- func (hs *HttpServer) Announce(w http.ResponseWriter, r *http.Request)
- func (hs *HttpServer) Bootstrap(w http.ResponseWriter, r *http.Request)
- func (hs *HttpServer) CpuProfile(w http.ResponseWriter, r *http.Request)
- func (hs *HttpServer) FtsIndex(w http.ResponseWriter, r *http.Request)
- func (hs *HttpServer) IndexHandler(w http.ResponseWriter, r *http.Request)
- func (hs *HttpServer) ListenHttp(addr string)
- func (hs *HttpServer) MemProfile(w http.ResponseWriter, r *http.Request)
- func (hs *HttpServer) Mirror(w http.ResponseWriter, r *http.Request)
- func (hs *HttpServer) MirrorProgress(w http.ResponseWriter, r *http.Request)
- func (hs *HttpServer) NetMap(w http.ResponseWriter, r *http.Request)
- func (hs *HttpServer) PeerFtsIndex(w http.ResponseWriter, r *http.Request)
- func (hs *HttpServer) PeerRSearch(w http.ResponseWriter, r *http.Request)
- func (hs *HttpServer) PeerSearch(w http.ResponseWriter, r *http.Request)
- func (hs *HttpServer) Peers(w http.ResponseWriter, r *http.Request)
- func (hs *HttpServer) Ping(w http.ResponseWriter, r *http.Request)
- func (hs *HttpServer) Popular(w http.ResponseWriter, r *http.Request)
- func (hs *HttpServer) RebuildCollection(w http.ResponseWriter, r *http.Request)
- func (hs *HttpServer) Recent(w http.ResponseWriter, r *http.Request)
- func (hs *HttpServer) RequestAddPeer(w http.ResponseWriter, r *http.Request)
- func (hs *HttpServer) Resolve(w http.ResponseWriter, r *http.Request)
- func (hs *HttpServer) SaveCollection(w http.ResponseWriter, r *http.Request)
- func (hs *HttpServer) SearchEntry(w http.ResponseWriter, r *http.Request)
- func (hs *HttpServer) SelfExplore(w http.ResponseWriter, r *http.Request)
- func (hs *HttpServer) SelfGet(w http.ResponseWriter, r *http.Request)
- func (hs *HttpServer) SelfPopular(w http.ResponseWriter, r *http.Request)
- func (hs *HttpServer) SelfRecent(w http.ResponseWriter, r *http.Request)
- func (hs *HttpServer) SelfSearch(w http.ResponseWriter, r *http.Request)
- func (hs *HttpServer) SelfSet(w http.ResponseWriter, r *http.Request)
- func (hs *HttpServer) SelfSuggest(w http.ResponseWriter, r *http.Request)
- func (hs *HttpServer) SetSeedLeech(w http.ResponseWriter, r *http.Request)
- type LocalPeer
- func (lp *LocalPeer) AddEntry(entry dht.Entry) error
- func (lp *LocalPeer) AddPost(p data.Post, store bool) (int64, error)
- func (lp *LocalPeer) AddSeeding(entry dht.Entry) error
- func (lp *LocalPeer) Close()
- func (lp *LocalPeer) ConnectPeer(addr dht.Address) (*Peer, *dht.Entry, error)
- func (lp *LocalPeer) ConnectPeerDirect(addr string) (*Peer, error)
- func (lp *LocalPeer) GenerateKey()
- func (lp *LocalPeer) GetNetworkPeer(addr dht.Address) proto.NetworkPeer
- func (lp *LocalPeer) GetPeer(addr dht.Address) *Peer
- func (lp *LocalPeer) GetSocksPort() int
- func (lp *LocalPeer) HandleAddPeer(msg *proto.Message) error
- func (lp *LocalPeer) HandleAnnounce(msg *proto.Message) error
- func (lp *LocalPeer) HandleCloseConnection(addr *dht.Address)
- func (lp *LocalPeer) HandleFindClosest(msg *proto.Message) error
- func (lp *LocalPeer) HandleHandshake(header proto.ConnHeader) (proto.NetworkPeer, error)
- func (lp *LocalPeer) HandleHashList(msg *proto.Message) error
- func (lp *LocalPeer) HandlePiece(msg *proto.Message) error
- func (lp *LocalPeer) HandlePopular(msg *proto.Message) error
- func (lp *LocalPeer) HandleQuery(msg *proto.Message) error
- func (lp *LocalPeer) HandleRecent(msg *proto.Message) error
- func (lp *LocalPeer) HandleSearch(msg *proto.Message) error
- func (lp *LocalPeer) Listen(addr string)
- func (lp *LocalPeer) ListenStream(peer *Peer)
- func (lp *LocalPeer) LoadEntry() error
- func (lp *LocalPeer) PeerCount() int
- func (lp *LocalPeer) Peers() map[string]*Peer
- func (lp *LocalPeer) QueryEntry(addr dht.Address) (*dht.Entry, error)
- func (lp *LocalPeer) QuerySelf()
- func (lp *LocalPeer) ReadKey() error
- func (lp *LocalPeer) Resolve(addr dht.Address) (*dht.Entry, error)
- func (lp *LocalPeer) SaveEntry() error
- func (lp *LocalPeer) SetNetworkPeer(p proto.NetworkPeer)
- func (lp *LocalPeer) SetPeer(p *Peer)
- func (lp *LocalPeer) SetSocks(on bool)
- func (lp *LocalPeer) SetSocksPort(port int)
- func (lp *LocalPeer) Setup()
- func (lp *LocalPeer) Sign(msg []byte) []byte
- func (lp *LocalPeer) SignEntry()
- func (lp *LocalPeer) StartExploring() error
- func (lp *LocalPeer) WriteKey() error
- type MapLink
- type MapNode
- type Peer
- func (p *Peer) AddStream(conn net.Conn)
- func (p *Peer) Address() *dht.Address
- func (p *Peer) Announce(lp *LocalPeer) error
- func (p *Peer) Bootstrap(d *dht.DHT) error
- func (p *Peer) CloseStreams()
- func (p *Peer) Connect(addr string, lp *LocalPeer) error
- func (p *Peer) ConnectClient(lp *LocalPeer) (*yamux.Session, error)
- func (p *Peer) ConnectServer() (*yamux.Session, error)
- func (p *Peer) EAddress() common.Encoder
- func (p *Peer) Entry() (*dht.Entry, error)
- func (p *Peer) FindClosest(address dht.Address) ([]common.Verifier, error)
- func (p *Peer) GetCapabilities() *proto.MessageCapabilities
- func (p *Peer) GetEntry() (*dht.Entry, error)
- func (p *Peer) GetStream(conn net.Conn) *proto.Client
- func (p *Peer) Mirror(db *data.Database, lp dht.Address, onPiece chan int) error
- func (p *Peer) NewMessage(header string) *proto.Message
- func (p *Peer) OpenStream() (*proto.Client, error)
- func (p *Peer) Ping(timeOut time.Duration) (time.Duration, error)
- func (p *Peer) Popular(page int) ([]*data.Post, error)
- func (p *Peer) PublicKey() []byte
- func (p *Peer) Query(address dht.Address) (common.Verifier, error)
- func (p *Peer) Recent(page int) ([]*data.Post, error)
- func (p *Peer) RemoveStream(conn net.Conn)
- func (p *Peer) RequestAddPeer(entry dht.Entry) error
- func (p *Peer) Search(search string, page int) (*data.SearchResult, error)
- func (p *Peer) Session() *yamux.Session
- func (p *Peer) SetCapabilities(caps proto.MessageCapabilities)
- func (p *Peer) SetTCP(header proto.ConnHeader)
- func (p *Peer) Streams() *proto.StreamManager
- func (p *Peer) Terminate()
- func (p *Peer) UpdateSeen()
- type PeerManager
- func (pm *PeerManager) AddSeedManager(addr dht.Address) error
- func (pm *PeerManager) ConnectPeer(addr dht.Address) (*Peer, *dht.Entry, error)
- func (pm *PeerManager) ConnectPeerDirect(addr string) (*Peer, error)
- func (pm *PeerManager) Count() int
- func (pm *PeerManager) GetPeer(addr dht.Address) *Peer
- func (pm *PeerManager) HandleCloseConnection(addr *dht.Address)
- func (pm *PeerManager) LoadSeeds() error
- func (pm *PeerManager) Peers() map[string]*Peer
- func (pm *PeerManager) Resolve(addr dht.Address) (*dht.Entry, error)
- func (pm *PeerManager) SetPeer(p *Peer)
- type SeedManager
Constants ¶
const AnnounceFrequency = time.Minute * 30
const HeartbeatFrequency = time.Second * 30
const MaxSearchLength = 256
const ResolveListSize = 1
const SeedSearchFrequency = time.Minute * 5
const TimeBeforeReExplore = 60 * 60
Variables ¶
Functions ¶
func CreateNetMap ¶
func CreateNetMap(entry dht.Entry, db *dht.DHT, currentNodes map[string]bool, currentLinks map[string]bool) ([]MapNode, []MapLink)
This takes a node to start with, and recurses through all seeds/seeding
func ExternalIp ¶
func ExternalIp() string
TODO: Make this check using UpNp/NAT_PMP first, then query services.
func SetupZifTorService ¶
Types ¶
type CommandAddMeta ¶
type CommandAddMeta struct { CommandMeta Value string `json:"value"` }
type CommandAddPost ¶
type CommandAddressEncode ¶
type CommandAddressEncode struct {
Raw []byte `json:"raw"`
}
type CommandAnnounce ¶
type CommandAnnounce CommandPeer
type CommandBootstrap ¶
type CommandBootstrap CommandPeer
type CommandFile ¶
type CommandFile struct {
File string `json:"file"`
}
type CommandGetMeta ¶
type CommandGetMeta CommandMeta
type CommandLocalGet ¶
type CommandLocalGet struct {
Key string `json:"key"`
}
type CommandLocalSet ¶
Used for setting values in the localpeer entry
type CommandMeta ¶
type CommandMeta struct {
PId int `json:"pid"`
}
type CommandMirror ¶
type CommandMirror CommandPeer
type CommandMirrorProgress ¶
type CommandMirrorProgress CommandPeer
type CommandNetMap ¶
type CommandNetMap struct {
Address string
}
type CommandPeer ¶
type CommandPeer struct {
Address string `json:"address"`
}
type CommandPeerIndex ¶
type CommandPeerIndex struct { CommandPeer Since int `json:"since"` }
type CommandPeerPopular ¶
type CommandPeerPopular CommandPeerRecent
type CommandPeerRecent ¶
type CommandPeerRecent struct { CommandPeer Page int `json:"page"` }
type CommandPeerSearch ¶
type CommandPeerSearch CommandRSearch
type CommandPeers ¶
type CommandPeers interface{}
type CommandPing ¶
type CommandPing CommandPeer
type CommandRSearch ¶
type CommandRSearch struct { CommandPeer Query string `json:"query"` Page int `json:"page"` }
type CommandRebuildCollection ¶
type CommandRebuildCollection interface{}
type CommandRequestAddPeer ¶
type CommandResolve ¶
type CommandResolve CommandPeer
type CommandResult ¶
type CommandResult struct { IsOK bool `json:"status"` Result interface{} `json:"value"` Error error `json:"err"` }
func (*CommandResult) WriteJSON ¶
func (cr *CommandResult) WriteJSON(w io.Writer)
type CommandSaveCollection ¶
type CommandSaveCollection interface{}
type CommandSaveRoutingTable ¶
type CommandSaveRoutingTable interface{}
type CommandSearchEntry ¶
type CommandSelfIndex ¶
type CommandSelfIndex struct {
Since int `json:"since"`
}
type CommandSelfPopular ¶
type CommandSelfPopular CommandSelfRecent
type CommandSelfRecent ¶
type CommandSelfRecent struct {
Page int `json:"page"`
}
type CommandSelfSearch ¶
type CommandSelfSearch struct { CommandSuggest Page int `json:"page"` }
type CommandServer ¶
type CommandServer struct { LocalPeer *LocalPeer // Piece count for ongoing mirrors MirrorProgress cmap.ConcurrentMap }
func NewCommandServer ¶
func NewCommandServer(lp *LocalPeer) *CommandServer
func (*CommandServer) AddMeta ¶
func (cs *CommandServer) AddMeta(cam CommandAddMeta) CommandResult
func (*CommandServer) AddPost ¶
func (cs *CommandServer) AddPost(ap CommandAddPost) CommandResult
func (*CommandServer) AddressEncode ¶
func (cs *CommandServer) AddressEncode(ce CommandAddressEncode) CommandResult
func (*CommandServer) Announce ¶
func (cs *CommandServer) Announce(a CommandAnnounce) CommandResult
func (*CommandServer) Bootstrap ¶
func (cs *CommandServer) Bootstrap(cb CommandBootstrap) CommandResult
func (*CommandServer) EntrySearch ¶
func (cs *CommandServer) EntrySearch(ps CommandSearchEntry) CommandResult
func (*CommandServer) Explore ¶
func (cs *CommandServer) Explore() CommandResult
func (*CommandServer) GetMirrorProgress ¶
func (cs *CommandServer) GetMirrorProgress(cmp CommandMirrorProgress) CommandResult
func (*CommandServer) LocalGet ¶
func (cs *CommandServer) LocalGet(clg CommandLocalGet) CommandResult
func (*CommandServer) LocalSet ¶
func (cs *CommandServer) LocalSet(cls CommandLocalSet) CommandResult
Set a value in the localpeer entry
func (*CommandServer) MemProfile ¶
func (cs *CommandServer) MemProfile(cf CommandFile) CommandResult
func (*CommandServer) Mirror ¶
func (cs *CommandServer) Mirror(cm CommandMirror) CommandResult
func (*CommandServer) NetMap ¶
func (cs *CommandServer) NetMap(cnm CommandNetMap) CommandResult
func (*CommandServer) PeerIndex ¶
func (cs *CommandServer) PeerIndex(ci CommandPeerIndex) CommandResult
func (*CommandServer) PeerPopular ¶
func (cs *CommandServer) PeerPopular(pp CommandPeerPopular) CommandResult
func (*CommandServer) PeerRecent ¶
func (cs *CommandServer) PeerRecent(pr CommandPeerRecent) CommandResult
func (*CommandServer) PeerSearch ¶
func (cs *CommandServer) PeerSearch(ps CommandPeerSearch) CommandResult
func (*CommandServer) Peers ¶
func (cs *CommandServer) Peers(cp CommandPeers) CommandResult
func (*CommandServer) Ping ¶
func (cs *CommandServer) Ping(p CommandPing) CommandResult
func (*CommandServer) RSearch ¶
func (cs *CommandServer) RSearch(rs CommandRSearch) CommandResult
func (*CommandServer) RebuildCollection ¶
func (cs *CommandServer) RebuildCollection(crc CommandRebuildCollection) CommandResult
func (*CommandServer) RequestAddPeer ¶
func (cs *CommandServer) RequestAddPeer(crap CommandRequestAddPeer) CommandResult
func (*CommandServer) Resolve ¶
func (cs *CommandServer) Resolve(cr CommandResolve) CommandResult
func (*CommandServer) SaveCollection ¶
func (cs *CommandServer) SaveCollection(csc CommandSaveCollection) CommandResult
func (*CommandServer) SelfIndex ¶
func (cs *CommandServer) SelfIndex(ci CommandSelfIndex) CommandResult
func (*CommandServer) SelfPopular ¶
func (cs *CommandServer) SelfPopular(cp CommandSelfPopular) CommandResult
func (*CommandServer) SelfRecent ¶
func (cs *CommandServer) SelfRecent(cr CommandSelfRecent) CommandResult
func (*CommandServer) SelfSearch ¶
func (cs *CommandServer) SelfSearch(css CommandSelfSearch) CommandResult
func (*CommandServer) SelfSuggest ¶
func (cs *CommandServer) SelfSuggest(css CommandSuggest) CommandResult
func (*CommandServer) SetSeedLeech ¶
func (cs *CommandServer) SetSeedLeech(csl CommandSetSeedLeech) CommandResult
func (*CommandServer) StartCpuProfile ¶
func (cs *CommandServer) StartCpuProfile(cf CommandFile) CommandResult
func (*CommandServer) StopCpuProfile ¶
func (cs *CommandServer) StopCpuProfile() CommandResult
type CommandSetSeedLeech ¶
type CommandSuggest ¶
type CommandSuggest struct {
Query string `json:"query"`
}
type HttpServer ¶
type HttpServer struct {
CommandServer *CommandServer
}
func (*HttpServer) AddMeta ¶
func (hs *HttpServer) AddMeta(w http.ResponseWriter, r *http.Request)
func (*HttpServer) AddPost ¶
func (hs *HttpServer) AddPost(w http.ResponseWriter, r *http.Request)
func (*HttpServer) AddressEncode ¶
func (hs *HttpServer) AddressEncode(w http.ResponseWriter, r *http.Request)
func (*HttpServer) Announce ¶
func (hs *HttpServer) Announce(w http.ResponseWriter, r *http.Request)
func (*HttpServer) Bootstrap ¶
func (hs *HttpServer) Bootstrap(w http.ResponseWriter, r *http.Request)
func (*HttpServer) CpuProfile ¶
func (hs *HttpServer) CpuProfile(w http.ResponseWriter, r *http.Request)
func (*HttpServer) FtsIndex ¶
func (hs *HttpServer) FtsIndex(w http.ResponseWriter, r *http.Request)
func (*HttpServer) IndexHandler ¶
func (hs *HttpServer) IndexHandler(w http.ResponseWriter, r *http.Request)
func (*HttpServer) ListenHttp ¶
func (hs *HttpServer) ListenHttp(addr string)
func (*HttpServer) MemProfile ¶
func (hs *HttpServer) MemProfile(w http.ResponseWriter, r *http.Request)
func (*HttpServer) Mirror ¶
func (hs *HttpServer) Mirror(w http.ResponseWriter, r *http.Request)
func (*HttpServer) MirrorProgress ¶
func (hs *HttpServer) MirrorProgress(w http.ResponseWriter, r *http.Request)
func (*HttpServer) NetMap ¶
func (hs *HttpServer) NetMap(w http.ResponseWriter, r *http.Request)
func (*HttpServer) PeerFtsIndex ¶
func (hs *HttpServer) PeerFtsIndex(w http.ResponseWriter, r *http.Request)
func (*HttpServer) PeerRSearch ¶
func (hs *HttpServer) PeerRSearch(w http.ResponseWriter, r *http.Request)
func (*HttpServer) PeerSearch ¶
func (hs *HttpServer) PeerSearch(w http.ResponseWriter, r *http.Request)
func (*HttpServer) Peers ¶
func (hs *HttpServer) Peers(w http.ResponseWriter, r *http.Request)
func (*HttpServer) Ping ¶
func (hs *HttpServer) Ping(w http.ResponseWriter, r *http.Request)
func (*HttpServer) Popular ¶
func (hs *HttpServer) Popular(w http.ResponseWriter, r *http.Request)
func (*HttpServer) RebuildCollection ¶
func (hs *HttpServer) RebuildCollection(w http.ResponseWriter, r *http.Request)
func (*HttpServer) Recent ¶
func (hs *HttpServer) Recent(w http.ResponseWriter, r *http.Request)
func (*HttpServer) RequestAddPeer ¶
func (hs *HttpServer) RequestAddPeer(w http.ResponseWriter, r *http.Request)
func (*HttpServer) Resolve ¶
func (hs *HttpServer) Resolve(w http.ResponseWriter, r *http.Request)
func (*HttpServer) SaveCollection ¶
func (hs *HttpServer) SaveCollection(w http.ResponseWriter, r *http.Request)
func (*HttpServer) SearchEntry ¶
func (hs *HttpServer) SearchEntry(w http.ResponseWriter, r *http.Request)
func (*HttpServer) SelfExplore ¶
func (hs *HttpServer) SelfExplore(w http.ResponseWriter, r *http.Request)
func (*HttpServer) SelfGet ¶
func (hs *HttpServer) SelfGet(w http.ResponseWriter, r *http.Request)
func (*HttpServer) SelfPopular ¶
func (hs *HttpServer) SelfPopular(w http.ResponseWriter, r *http.Request)
func (*HttpServer) SelfRecent ¶
func (hs *HttpServer) SelfRecent(w http.ResponseWriter, r *http.Request)
TODO: SelfSuggest after merge
func (*HttpServer) SelfSearch ¶
func (hs *HttpServer) SelfSearch(w http.ResponseWriter, r *http.Request)
func (*HttpServer) SelfSet ¶
func (hs *HttpServer) SelfSet(w http.ResponseWriter, r *http.Request)
func (*HttpServer) SelfSuggest ¶
func (hs *HttpServer) SelfSuggest(w http.ResponseWriter, r *http.Request)
func (*HttpServer) SetSeedLeech ¶
func (hs *HttpServer) SetSeedLeech(w http.ResponseWriter, r *http.Request)
type LocalPeer ¶
type LocalPeer struct { Peer Entry *dht.Entry DHT *dht.DHT Server *proto.Server Collection *data.Collection Database *data.Database PublicAddress string // These are the databases of all of the peers that we have mirrored. Databases cmap.ConcurrentMap Collections cmap.ConcurrentMap SearchProvider *data.SearchProvider // contains filtered or unexported fields }
func (*LocalPeer) ConnectPeer ¶
func (*LocalPeer) ConnectPeerDirect ¶
func (*LocalPeer) GetNetworkPeer ¶
func (lp *LocalPeer) GetNetworkPeer(addr dht.Address) proto.NetworkPeer
func (*LocalPeer) GetSocksPort ¶
func (*LocalPeer) HandleCloseConnection ¶
func (*LocalPeer) HandleFindClosest ¶
func (*LocalPeer) HandleHandshake ¶
func (lp *LocalPeer) HandleHandshake(header proto.ConnHeader) (proto.NetworkPeer, error)
func (*LocalPeer) HandleQuery ¶
Querying peer sends a Zif address This peer will respond with a list of the k closest peers, ordered by distance. The top peer may well be the one that is being queried for :)
func (*LocalPeer) ListenStream ¶
func (*LocalPeer) QueryEntry ¶
func (*LocalPeer) ReadKey ¶
Read the private key from file. This is the "identity.dat" file. The public key is also then generated from the private key.
func (*LocalPeer) SetNetworkPeer ¶
func (lp *LocalPeer) SetNetworkPeer(p proto.NetworkPeer)
func (*LocalPeer) SetSocksPort ¶
func (*LocalPeer) StartExploring ¶
type Peer ¶
type Peer struct {
// contains filtered or unexported fields
}
func (*Peer) CloseStreams ¶
func (p *Peer) CloseStreams()
func (*Peer) FindClosest ¶
func (*Peer) GetCapabilities ¶
func (p *Peer) GetCapabilities() *proto.MessageCapabilities
func (*Peer) RemoveStream ¶
func (*Peer) SetCapabilities ¶
func (p *Peer) SetCapabilities(caps proto.MessageCapabilities)
func (*Peer) SetTCP ¶
func (p *Peer) SetTCP(header proto.ConnHeader)
func (*Peer) Streams ¶
func (p *Peer) Streams() *proto.StreamManager
func (*Peer) UpdateSeen ¶
func (p *Peer) UpdateSeen()
type PeerManager ¶
type PeerManager struct {
// contains filtered or unexported fields
}
handles peer connections
func NewPeerManager ¶
func NewPeerManager(lp *LocalPeer) *PeerManager
func (*PeerManager) AddSeedManager ¶
func (pm *PeerManager) AddSeedManager(addr dht.Address) error
func (*PeerManager) ConnectPeer ¶
Resolved a Zif address into an entry, connects to the peer at the PublicAddress in the Entry, then return it. The peer is also stored in a map.
func (*PeerManager) ConnectPeerDirect ¶
func (pm *PeerManager) ConnectPeerDirect(addr string) (*Peer, error)
Given a direct address, for instance an IP or domain, connect to the peer there. This can be used for something like bootstrapping, or for something like connecting to a peer whose Zif address we have just resolved.
func (*PeerManager) Count ¶
func (pm *PeerManager) Count() int
func (*PeerManager) HandleCloseConnection ¶
func (pm *PeerManager) HandleCloseConnection(addr *dht.Address)
func (*PeerManager) LoadSeeds ¶
func (pm *PeerManager) LoadSeeds() error
func (*PeerManager) Peers ¶
func (pm *PeerManager) Peers() map[string]*Peer
func (*PeerManager) Resolve ¶
Resolves a Zif address into an entry. Hopefully we already have the entry, in which case it's just loaded from disk. Otherwise, recursive network queries are made to try and find it.
func (*PeerManager) SetPeer ¶
func (pm *PeerManager) SetPeer(p *Peer)
type SeedManager ¶
type SeedManager struct { Close chan bool // contains filtered or unexported fields }
func NewSeedManager ¶
func NewSeedManager(track dht.Address, lp *LocalPeer) (*SeedManager, error)
Creates a new seed manager, given an address to track seeds for and the localpeer.