Documentation
¶
Overview ¶
Package hidden is a manager for hidden services.
Index ¶
- func FormatReply(header RoutingHeaderBytes, ciphers crypto.Ciphers, nonces crypto.Nonces, ...) (rb *splice.Splice)
- func ReadRoutingHeader(s *splice.Splice, b *RoutingHeaderBytes) *splice.Splice
- func WriteRoutingHeader(s *splice.Splice, b RoutingHeaderBytes) *splice.Splice
- type Hidden
- func (hr *Hidden) AddHiddenService(svc *services.Service, key *crypto.Prv, in *intro.Ad, addr string)
- func (hr *Hidden) AddIntro(pk *crypto.Pub, intro *Introduction)
- func (hr *Hidden) AddIntroToHiddenService(key crypto.PubBytes, in *intro.Ad)
- func (hr *Hidden) Delete(key crypto.PubBytes) (header *Introduction)
- func (hr *Hidden) DeleteIntroByID(id nonce.ID)
- func (hr *Hidden) DeleteKnownIntro(key crypto.PubBytes) (header *Introduction)
- func (hr *Hidden) FindCloakedHiddenService(key crypto.CloakedPubKey) (pubKey *crypto.PubBytes)
- func (hr *Hidden) FindHiddenService(key crypto.PubBytes) (hs *LocalHiddenService)
- func (hr *Hidden) FindIntroduction(key crypto.PubBytes) (intro *Introduction)
- func (hr *Hidden) FindIntroductionUnsafe(key crypto.PubBytes) (intro *Introduction)
- func (hr *Hidden) FindKnownIntro(key crypto.PubBytes) (intro *intro.Ad)
- func (hr *Hidden) FindKnownIntroUnsafe(key crypto.PubBytes) (intro *intro.Ad)
- type Introduction
- type KnownIntros
- type LocalHiddenService
- type MyIntros
- type ReplyHeader
- type RoutingHeaderBytes
- type Services
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatReply ¶
func FormatReply(header RoutingHeaderBytes, ciphers crypto.Ciphers, nonces crypto.Nonces, res slice.Bytes) (rb *splice.Splice)
FormatReply constructs a reply message with RoutingHeader, ciphers and nonces, and the response payload, encrypting it and writing it into a splice.
func ReadRoutingHeader ¶
func ReadRoutingHeader(s *splice.Splice, b *RoutingHeaderBytes) *splice.Splice
ReadRoutingHeader extracts a RoutingHeaderBytes from a splice at the current cursor.
func WriteRoutingHeader ¶
func WriteRoutingHeader(s *splice.Splice, b RoutingHeaderBytes) *splice.Splice
WriteRoutingHeader copies RoutingHeaderBytes into a splice.
Types ¶
type Hidden ¶
type Hidden struct { // Mutex because this needs to be concurrent safe. sync.Mutex // MyIntros are hidden services being hosted in this current engine. MyIntros // KnownIntros are hidden services we have heard of and can return to a query if we have them. // // todo: this probably belongs with the peerstore... KnownIntros // Services are the service specifications for the services we are providing from this engine. Services }
Hidden is a collection of data related to hidden services. Introductions both own and other, hidden services.
func NewHiddenRouting ¶ added in v0.1.19
func NewHiddenRouting() *Hidden
NewHiddenRouting instantiates a new Hidden for managing hidden services.
func (*Hidden) AddHiddenService ¶
func (hr *Hidden) AddHiddenService(svc *services.Service, key *crypto.Prv, in *intro.Ad, addr string)
AddHiddenService adds a new hidden service with a given private key, intro and address.
todo: looks like that addr parameter should be in a logging closure derived from the key.
func (*Hidden) AddIntro ¶
func (hr *Hidden) AddIntro(pk *crypto.Pub, intro *Introduction)
AddIntro adds an intro for a newly created hidden service.
func (*Hidden) AddIntroToHiddenService ¶
AddIntroToHiddenService adds an intro to a given hidden service.
todo: this looks like it isn't used.
func (*Hidden) Delete ¶
func (hr *Hidden) Delete(key crypto.PubBytes) (header *Introduction)
Delete removes a hidden service identified by its public key bytes.
func (*Hidden) DeleteIntroByID ¶
DeleteIntroByID removes the Intro with matching nonce.ID.
func (*Hidden) DeleteKnownIntro ¶
func (hr *Hidden) DeleteKnownIntro(key crypto.PubBytes) ( header *Introduction)
DeleteKnownIntro evicts a known intro.
todo: this really should be integrated with the peerstore.
func (*Hidden) FindCloakedHiddenService ¶
func (hr *Hidden) FindCloakedHiddenService(key crypto.CloakedPubKey) ( pubKey *crypto.PubBytes)
FindCloakedHiddenService checks known local hidden service keys to match a "To" cloaked public key, for which we should have the private key to form the ECDH secret to decrypt the message.
func (*Hidden) FindHiddenService ¶
func (hr *Hidden) FindHiddenService(key crypto.PubBytes) ( hs *LocalHiddenService)
FindHiddenService searches for a hidden service from local hidden services.
func (*Hidden) FindIntroduction ¶
func (hr *Hidden) FindIntroduction(key crypto.PubBytes) (intro *Introduction)
FindIntroduction returns the intro.Ad matching a provided public key bytes.
func (*Hidden) FindIntroductionUnsafe ¶
func (hr *Hidden) FindIntroductionUnsafe( key crypto.PubBytes) (intro *Introduction)
FindIntroductionUnsafe does the same thing as FindIntroduction without locking. Used when the lock is already acquired.
func (*Hidden) FindKnownIntro ¶
FindKnownIntro searches non-local intros for a matching public key bytes.
todo: this definitely should be part of peerstore.
type Introduction ¶
type Introduction struct { Intro *intro.Ad ReplyHeader }
Introduction is the combination of an intro.Ad and a ReplyHeader, used to forward the Route message from a client and establish the connection between client and hidden service.
type KnownIntros ¶
KnownIntros is a key/value store of hidden service intros we know of.
todo: This definitely should be peerstore
type LocalHiddenService ¶
type LocalHiddenService struct { // Prv is the private key for the hidden service. Prv *crypto.Prv // CurrentIntros are intro.Ad that are current for this hidden service. Not sure // yet how many this should be. 6 or more, it really depends, perhaps have it // scale up if demand exceeds supply to some sort of reasonable ceiling. CurrentIntros []*intro.Ad // Service is the definition of the hidden service. There should be a server // listening on or forwarding from the service port on localhost that provides // the service. *services.Service }
LocalHiddenService is a hidden service being served from this node.
type MyIntros ¶
type MyIntros map[crypto.PubBytes]*Introduction
MyIntros is a key value store of the hidden service introductions we have got currently available and sent out to introducing nodes.
type ReplyHeader ¶
type ReplyHeader struct { // RoutingHeaderBytes contains the 3 layer RoutingHeader that holds the path // instructions in three progressively encrypted layers in reverse order so to be // unwrapped progressively. RoutingHeaderBytes // Ciphers is a set of 3 symmetric ciphers that are to be used in their // given order over the reply message from the service. crypto.Ciphers // Nonces are the nonces to use with the cipher when creating the // encryption for the reply message, // they are common with the crypts in the header. crypto.Nonces }
ReplyHeader is the bundle of routing header, payload encryption secrets and the nonces to be used, which match also what is inside the RoutingHeaderBytes.
type RoutingHeaderBytes ¶
type RoutingHeaderBytes [consts.RoutingHeaderLen]byte
RoutingHeaderBytes is a raw bytes form of a 3 layer RoutingHeader.
func GetRoutingHeaderFromCursor ¶
func GetRoutingHeaderFromCursor(s *splice.Splice) (r RoutingHeaderBytes)
GetRoutingHeaderFromCursor extracts what should be a routing header from a splice.
type Services ¶
type Services map[crypto.PubBytes]*LocalHiddenService
Services is a map of local hidden services keyed to their public key.