finishing rename of intro
This commit is contained in:
@@ -1,9 +1,9 @@
|
|||||||
package engine
|
package engine
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"github.com/indra-labs/indra/pkg/onions/adintro"
|
||||||
"github.com/indra-labs/indra/pkg/onions/exit"
|
"github.com/indra-labs/indra/pkg/onions/exit"
|
||||||
"github.com/indra-labs/indra/pkg/onions/getbalance"
|
"github.com/indra-labs/indra/pkg/onions/getbalance"
|
||||||
"github.com/indra-labs/indra/pkg/onions/intro"
|
|
||||||
"github.com/indra-labs/indra/pkg/onions/message"
|
"github.com/indra-labs/indra/pkg/onions/message"
|
||||||
"github.com/indra-labs/indra/pkg/onions/ont"
|
"github.com/indra-labs/indra/pkg/onions/ont"
|
||||||
"github.com/indra-labs/indra/pkg/onions/reg"
|
"github.com/indra-labs/indra/pkg/onions/reg"
|
||||||
@@ -55,7 +55,7 @@ func (ng *Engine) SendGetBalance(alice, bob *sessions.Data, hook responses.Callb
|
|||||||
func (ng *Engine) SendHiddenService(id nonce.ID, key *crypto.Prv,
|
func (ng *Engine) SendHiddenService(id nonce.ID, key *crypto.Prv,
|
||||||
relayRate uint32, port uint16, expiry time.Time,
|
relayRate uint32, port uint16, expiry time.Time,
|
||||||
alice, bob *sessions.Data, svc *services.Service,
|
alice, bob *sessions.Data, svc *services.Service,
|
||||||
hook responses.Callback) (in *intro.Ad) {
|
hook responses.Callback) (in *adintro.Ad) {
|
||||||
|
|
||||||
hops := sess.StandardCircuit()
|
hops := sess.StandardCircuit()
|
||||||
s := make(sessions.Sessions, len(hops))
|
s := make(sessions.Sessions, len(hops))
|
||||||
@@ -63,7 +63,7 @@ func (ng *Engine) SendHiddenService(id nonce.ID, key *crypto.Prv,
|
|||||||
se := ng.Manager.SelectHops(hops, s, "sendhiddenservice")
|
se := ng.Manager.SelectHops(hops, s, "sendhiddenservice")
|
||||||
var c sessions.Circuit
|
var c sessions.Circuit
|
||||||
copy(c[:], se[:len(c)])
|
copy(c[:], se[:len(c)])
|
||||||
in = intro.NewIntroAd(id, key, alice.Node.AddrPort, relayRate, port, expiry)
|
in = adintro.NewIntroAd(id, key, alice.Node.AddrPort, relayRate, port, expiry)
|
||||||
o := MakeHiddenService(in, alice, bob, c, ng.KeySet)
|
o := MakeHiddenService(in, alice, bob, c, ng.KeySet)
|
||||||
log.D.F("%s sending out hidden service onion %s",
|
log.D.F("%s sending out hidden service onion %s",
|
||||||
ng.Manager.GetLocalNodeAddressString(),
|
ng.Manager.GetLocalNodeAddressString(),
|
||||||
@@ -76,7 +76,7 @@ func (ng *Engine) SendHiddenService(id nonce.ID, key *crypto.Prv,
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (ng *Engine) SendIntroQuery(id nonce.ID, hsk *crypto.Pub,
|
func (ng *Engine) SendIntroQuery(id nonce.ID, hsk *crypto.Pub,
|
||||||
alice, bob *sessions.Data, hook func(in *intro.Ad)) {
|
alice, bob *sessions.Data, hook func(in *adintro.Ad)) {
|
||||||
|
|
||||||
fn := func(id nonce.ID, ifc interface{}, b slice.Bytes) (e error) {
|
fn := func(id nonce.ID, ifc interface{}, b slice.Bytes) (e error) {
|
||||||
s := splice.Load(b, slice.NewCursor())
|
s := splice.Load(b, slice.NewCursor())
|
||||||
@@ -84,9 +84,9 @@ func (ng *Engine) SendIntroQuery(id nonce.ID, hsk *crypto.Pub,
|
|||||||
if e = on.Decode(s); fails(e) {
|
if e = on.Decode(s); fails(e) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
var oni *intro.Ad
|
var oni *adintro.Ad
|
||||||
var ok bool
|
var ok bool
|
||||||
if oni, ok = on.(*intro.Ad); !ok {
|
if oni, ok = on.(*adintro.Ad); !ok {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
hook(oni)
|
hook(oni)
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import (
|
|||||||
"github.com/indra-labs/indra/pkg/crypto/nonce"
|
"github.com/indra-labs/indra/pkg/crypto/nonce"
|
||||||
"github.com/indra-labs/indra/pkg/engine/node"
|
"github.com/indra-labs/indra/pkg/engine/node"
|
||||||
"github.com/indra-labs/indra/pkg/engine/sessions"
|
"github.com/indra-labs/indra/pkg/engine/sessions"
|
||||||
|
"github.com/indra-labs/indra/pkg/onions/adintro"
|
||||||
"github.com/indra-labs/indra/pkg/onions/confirmation"
|
"github.com/indra-labs/indra/pkg/onions/confirmation"
|
||||||
"github.com/indra-labs/indra/pkg/onions/crypt"
|
"github.com/indra-labs/indra/pkg/onions/crypt"
|
||||||
"github.com/indra-labs/indra/pkg/onions/end"
|
"github.com/indra-labs/indra/pkg/onions/end"
|
||||||
@@ -14,7 +15,6 @@ import (
|
|||||||
headers2 "github.com/indra-labs/indra/pkg/onions/headers"
|
headers2 "github.com/indra-labs/indra/pkg/onions/headers"
|
||||||
"github.com/indra-labs/indra/pkg/onions/hidden"
|
"github.com/indra-labs/indra/pkg/onions/hidden"
|
||||||
"github.com/indra-labs/indra/pkg/onions/hiddenservice"
|
"github.com/indra-labs/indra/pkg/onions/hiddenservice"
|
||||||
"github.com/indra-labs/indra/pkg/onions/intro"
|
|
||||||
"github.com/indra-labs/indra/pkg/onions/introquery"
|
"github.com/indra-labs/indra/pkg/onions/introquery"
|
||||||
"github.com/indra-labs/indra/pkg/onions/message"
|
"github.com/indra-labs/indra/pkg/onions/message"
|
||||||
"github.com/indra-labs/indra/pkg/onions/ont"
|
"github.com/indra-labs/indra/pkg/onions/ont"
|
||||||
@@ -35,11 +35,10 @@ func (o Skins) Confirmation(id nonce.ID, load byte) Skins {
|
|||||||
return append(o, confirmation.NewConfirmation(id, load))
|
return append(o, confirmation.NewConfirmation(id, load))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//func (o Skins) Delay(d time.Duration) Skins { return append(o, delay.NewDelay(d)) }
|
//func (o Skins) Delay(d time.Duration) Skins { return append(o, delay.NewDelay(d)) }
|
||||||
|
|
||||||
type (
|
type (
|
||||||
Skins []ont.Onion
|
Skins []ont.Onion
|
||||||
RoutingLayer struct {
|
RoutingLayer struct {
|
||||||
*reverse.Reverse
|
*reverse.Reverse
|
||||||
*crypt.Crypt
|
*crypt.Crypt
|
||||||
@@ -78,7 +77,7 @@ func (o Skins) GetBalance(id nonce.ID, ep *exit.ExitPoint) Skins {
|
|||||||
return append(o, getbalance.NewGetBalance(id, ep))
|
return append(o, getbalance.NewGetBalance(id, ep))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (o Skins) HiddenService(in *intro.Ad, point *exit.ExitPoint) Skins {
|
func (o Skins) HiddenService(in *adintro.Ad, point *exit.ExitPoint) Skins {
|
||||||
return append(o, hiddenservice.NewHiddenService(in, point))
|
return append(o, hiddenservice.NewHiddenService(in, point))
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -143,7 +142,7 @@ func MakeGetBalance(p getbalance.GetBalanceParams) Skins {
|
|||||||
RoutingHeader(headers.Return)
|
RoutingHeader(headers.Return)
|
||||||
}
|
}
|
||||||
|
|
||||||
func MakeHiddenService(in *intro.Ad, alice, bob *sessions.Data,
|
func MakeHiddenService(in *adintro.Ad, alice, bob *sessions.Data,
|
||||||
c sessions.Circuit, ks *crypto.KeySet) Skins {
|
c sessions.Circuit, ks *crypto.KeySet) Skins {
|
||||||
|
|
||||||
headers := headers2.GetHeaders(alice, bob, c, ks)
|
headers := headers2.GetHeaders(alice, bob, c, ks)
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import (
|
|||||||
"github.com/indra-labs/indra/pkg/engine/coding"
|
"github.com/indra-labs/indra/pkg/engine/coding"
|
||||||
"github.com/indra-labs/indra/pkg/engine/magic"
|
"github.com/indra-labs/indra/pkg/engine/magic"
|
||||||
"github.com/indra-labs/indra/pkg/engine/sess"
|
"github.com/indra-labs/indra/pkg/engine/sess"
|
||||||
"github.com/indra-labs/indra/pkg/onions/intro"
|
"github.com/indra-labs/indra/pkg/onions/adintro"
|
||||||
"github.com/indra-labs/indra/pkg/onions/reg"
|
"github.com/indra-labs/indra/pkg/onions/reg"
|
||||||
log2 "github.com/indra-labs/indra/pkg/proc/log"
|
log2 "github.com/indra-labs/indra/pkg/proc/log"
|
||||||
"github.com/indra-labs/indra/pkg/util/qu"
|
"github.com/indra-labs/indra/pkg/util/qu"
|
||||||
@@ -43,7 +43,7 @@ func New(id nonce.ID, key *crypto.Prv,
|
|||||||
relayRate uint32) (peerAd *Ad) {
|
relayRate uint32) (peerAd *Ad) {
|
||||||
|
|
||||||
pk := crypto.DerivePub(key)
|
pk := crypto.DerivePub(key)
|
||||||
s := splice.New(intro.Len - magic.Len)
|
s := splice.New(adintro.Len - magic.Len)
|
||||||
s.ID(id).
|
s.ID(id).
|
||||||
Pubkey(pk).
|
Pubkey(pk).
|
||||||
Uint32(relayRate)
|
Uint32(relayRate)
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import (
|
|||||||
"github.com/indra-labs/indra/pkg/engine/coding"
|
"github.com/indra-labs/indra/pkg/engine/coding"
|
||||||
"github.com/indra-labs/indra/pkg/engine/magic"
|
"github.com/indra-labs/indra/pkg/engine/magic"
|
||||||
"github.com/indra-labs/indra/pkg/engine/sess"
|
"github.com/indra-labs/indra/pkg/engine/sess"
|
||||||
"github.com/indra-labs/indra/pkg/onions/intro"
|
"github.com/indra-labs/indra/pkg/onions/adintro"
|
||||||
"github.com/indra-labs/indra/pkg/onions/reg"
|
"github.com/indra-labs/indra/pkg/onions/reg"
|
||||||
log2 "github.com/indra-labs/indra/pkg/proc/log"
|
log2 "github.com/indra-labs/indra/pkg/proc/log"
|
||||||
"github.com/indra-labs/indra/pkg/util/qu"
|
"github.com/indra-labs/indra/pkg/util/qu"
|
||||||
@@ -54,7 +54,7 @@ func NewServiceAd(
|
|||||||
port uint16,
|
port uint16,
|
||||||
) (sv *Ad) {
|
) (sv *Ad) {
|
||||||
|
|
||||||
s := splice.New(intro.Len)
|
s := splice.New(adintro.Len)
|
||||||
k := crypto.DerivePub(key)
|
k := crypto.DerivePub(key)
|
||||||
ServiceSplice(s, id, k, relayRate, port)
|
ServiceSplice(s, id, k, relayRate, port)
|
||||||
hash := sha256.Single(s.GetUntil(s.GetCursor()))
|
hash := sha256.Single(s.GetUntil(s.GetCursor()))
|
||||||
@@ -122,7 +122,7 @@ func (x *Ad) SpliceNoSig(s *splice.Splice) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (x *Ad) Validate() (valid bool) {
|
func (x *Ad) Validate() (valid bool) {
|
||||||
s := splice.New(intro.Len - magic.Len)
|
s := splice.New(adintro.Len - magic.Len)
|
||||||
x.SpliceNoSig(s)
|
x.SpliceNoSig(s)
|
||||||
hash := sha256.Single(s.GetUntil(s.GetCursor()))
|
hash := sha256.Single(s.GetUntil(s.GetCursor()))
|
||||||
key, e := x.Sig.Recover(hash)
|
key, e := x.Sig.Recover(hash)
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ import (
|
|||||||
"github.com/indra-labs/indra/pkg/crypto/ciph"
|
"github.com/indra-labs/indra/pkg/crypto/ciph"
|
||||||
"github.com/indra-labs/indra/pkg/crypto/nonce"
|
"github.com/indra-labs/indra/pkg/crypto/nonce"
|
||||||
"github.com/indra-labs/indra/pkg/engine/services"
|
"github.com/indra-labs/indra/pkg/engine/services"
|
||||||
|
"github.com/indra-labs/indra/pkg/onions/adintro"
|
||||||
"github.com/indra-labs/indra/pkg/onions/consts"
|
"github.com/indra-labs/indra/pkg/onions/consts"
|
||||||
"github.com/indra-labs/indra/pkg/onions/intro"
|
|
||||||
log2 "github.com/indra-labs/indra/pkg/proc/log"
|
log2 "github.com/indra-labs/indra/pkg/proc/log"
|
||||||
"github.com/indra-labs/indra/pkg/util/slice"
|
"github.com/indra-labs/indra/pkg/util/slice"
|
||||||
"github.com/indra-labs/indra/pkg/util/splice"
|
"github.com/indra-labs/indra/pkg/util/splice"
|
||||||
@@ -29,7 +29,7 @@ type Hidden struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (hr *Hidden) AddHiddenService(svc *services.Service, key *crypto.Prv,
|
func (hr *Hidden) AddHiddenService(svc *services.Service, key *crypto.Prv,
|
||||||
in *intro.Ad, addr string) {
|
in *adintro.Ad, addr string) {
|
||||||
pk := crypto.DerivePub(key).ToBytes()
|
pk := crypto.DerivePub(key).ToBytes()
|
||||||
hr.Lock()
|
hr.Lock()
|
||||||
log.D.F("%s added hidden service with key %s", addr, pk)
|
log.D.F("%s added hidden service with key %s", addr, pk)
|
||||||
@@ -54,7 +54,7 @@ func (hr *Hidden) AddIntro(pk *crypto.Pub, intro *Introduction) {
|
|||||||
hr.Unlock()
|
hr.Unlock()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (hr *Hidden) AddIntroToHiddenService(key crypto.PubBytes, in *intro.Ad) {
|
func (hr *Hidden) AddIntroToHiddenService(key crypto.PubBytes, in *adintro.Ad) {
|
||||||
hr.Lock()
|
hr.Lock()
|
||||||
hr.Services[key].CurrentIntros = append(hr.Services[key].
|
hr.Services[key].CurrentIntros = append(hr.Services[key].
|
||||||
CurrentIntros, in)
|
CurrentIntros, in)
|
||||||
@@ -176,7 +176,7 @@ func (hr *Hidden) FindIntroductionUnsafe(
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func (hr *Hidden) FindKnownIntro(key crypto.PubBytes) (intro *intro.Ad) {
|
func (hr *Hidden) FindKnownIntro(key crypto.PubBytes) (intro *adintro.Ad) {
|
||||||
hr.Lock()
|
hr.Lock()
|
||||||
var ok bool
|
var ok bool
|
||||||
if intro, ok = hr.KnownIntros[key]; ok {
|
if intro, ok = hr.KnownIntros[key]; ok {
|
||||||
@@ -185,7 +185,7 @@ func (hr *Hidden) FindKnownIntro(key crypto.PubBytes) (intro *intro.Ad) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func (hr *Hidden) FindKnownIntroUnsafe(key crypto.PubBytes) (intro *intro.Ad) {
|
func (hr *Hidden) FindKnownIntroUnsafe(key crypto.PubBytes) (intro *adintro.Ad) {
|
||||||
var ok bool
|
var ok bool
|
||||||
if intro, ok = hr.KnownIntros[key]; ok {
|
if intro, ok = hr.KnownIntros[key]; ok {
|
||||||
}
|
}
|
||||||
@@ -193,13 +193,13 @@ func (hr *Hidden) FindKnownIntroUnsafe(key crypto.PubBytes) (intro *intro.Ad) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type Introduction struct {
|
type Introduction struct {
|
||||||
Intro *intro.Ad
|
Intro *adintro.Ad
|
||||||
ReplyHeader
|
ReplyHeader
|
||||||
}
|
}
|
||||||
type KnownIntros map[crypto.PubBytes]*intro.Ad
|
type KnownIntros map[crypto.PubBytes]*adintro.Ad
|
||||||
type LocalHiddenService struct {
|
type LocalHiddenService struct {
|
||||||
Prv *crypto.Prv
|
Prv *crypto.Prv
|
||||||
CurrentIntros []*intro.Ad
|
CurrentIntros []*adintro.Ad
|
||||||
*services.Service
|
*services.Service
|
||||||
}
|
}
|
||||||
type MyIntros map[crypto.PubBytes]*Introduction
|
type MyIntros map[crypto.PubBytes]*Introduction
|
||||||
|
|||||||
@@ -9,11 +9,11 @@ import (
|
|||||||
"github.com/indra-labs/indra/pkg/engine/magic"
|
"github.com/indra-labs/indra/pkg/engine/magic"
|
||||||
"github.com/indra-labs/indra/pkg/engine/sess"
|
"github.com/indra-labs/indra/pkg/engine/sess"
|
||||||
"github.com/indra-labs/indra/pkg/engine/sessions"
|
"github.com/indra-labs/indra/pkg/engine/sessions"
|
||||||
|
"github.com/indra-labs/indra/pkg/onions/adintro"
|
||||||
"github.com/indra-labs/indra/pkg/onions/crypt"
|
"github.com/indra-labs/indra/pkg/onions/crypt"
|
||||||
"github.com/indra-labs/indra/pkg/onions/end"
|
"github.com/indra-labs/indra/pkg/onions/end"
|
||||||
"github.com/indra-labs/indra/pkg/onions/exit"
|
"github.com/indra-labs/indra/pkg/onions/exit"
|
||||||
"github.com/indra-labs/indra/pkg/onions/hidden"
|
"github.com/indra-labs/indra/pkg/onions/hidden"
|
||||||
"github.com/indra-labs/indra/pkg/onions/intro"
|
|
||||||
"github.com/indra-labs/indra/pkg/onions/ont"
|
"github.com/indra-labs/indra/pkg/onions/ont"
|
||||||
"github.com/indra-labs/indra/pkg/onions/reg"
|
"github.com/indra-labs/indra/pkg/onions/reg"
|
||||||
log2 "github.com/indra-labs/indra/pkg/proc/log"
|
log2 "github.com/indra-labs/indra/pkg/proc/log"
|
||||||
@@ -87,11 +87,11 @@ func (x *IntroQuery) Handle(s *splice.Splice, p ont.Onion, ng ont.Ngin) (e error
|
|||||||
log.D.Ln(ng.Mgr().GetLocalNodeAddressString(), "handling introquery", x.ID,
|
log.D.Ln(ng.Mgr().GetLocalNodeAddressString(), "handling introquery", x.ID,
|
||||||
x.Key.ToBased32Abbreviated())
|
x.Key.ToBased32Abbreviated())
|
||||||
var ok bool
|
var ok bool
|
||||||
var il *intro.Ad
|
var il *adintro.Ad
|
||||||
if il, ok = ng.GetHidden().KnownIntros[x.Key.ToBytes()]; !ok {
|
if il, ok = ng.GetHidden().KnownIntros[x.Key.ToBytes()]; !ok {
|
||||||
// if the reply is zeroes the querant knows it needs to retry at a
|
// if the reply is zeroes the querant knows it needs to retry at a
|
||||||
// different relay
|
// different relay
|
||||||
il = &intro.Ad{}
|
il = &adintro.Ad{}
|
||||||
ng.GetHidden().Unlock()
|
ng.GetHidden().Unlock()
|
||||||
log.E.Ln("intro not known")
|
log.E.Ln("intro not known")
|
||||||
return
|
return
|
||||||
|
|||||||
Reference in New Issue
Block a user