add network database interface
This commit is contained in:
14
lib/netdb/netdb.go
Normal file
14
lib/netdb/netdb.go
Normal file
@ -0,0 +1,14 @@
|
||||
package netdb
|
||||
|
||||
import (
|
||||
"github.com/bounce-chat/go-i2p/lib/common"
|
||||
)
|
||||
|
||||
// i2p network database, storage of i2p RouterInfos
|
||||
type NetworkDatabase interface {
|
||||
// obtain a RouterInfo by its hash
|
||||
// return a channel that gives 1 RouterInfo or nil if the RouterInfo cannot be found
|
||||
GetRouterInfo(hash common.Hash) chan *common.RouterInfo
|
||||
// store a router info locally
|
||||
StoreRouterInfo(ri *common.RouterInfo)
|
||||
}
|
@ -28,11 +28,11 @@ type Transport interface {
|
||||
// returns any errors that happen if they do
|
||||
SetIdentity(ident common.RouterIdentity) error
|
||||
|
||||
// Obtain a transport session with a router given its RouterInfo.
|
||||
// Obtain a transport session with a router given the Hash of its RouterInfo.
|
||||
// If a session with this router is NOT already made attempt to create one and block until made or until an error happens
|
||||
// returns an established TransportSession and nil on success
|
||||
// returns nil and an error on error
|
||||
GetSession(routerInfo common.RouterInfo) (TransportSession, error)
|
||||
GetSession(routerInfo common.Hash) (TransportSession, error)
|
||||
|
||||
// return true if a routerInfo is compatable with this transport
|
||||
Compatable(routerInfo common.RouterInfo) bool
|
||||
|
Reference in New Issue
Block a user