merged node and traffic packages

This commit is contained in:
херетик
2023-01-31 10:47:50 +00:00
parent ee9618c4d3
commit a83bfb06ef
34 changed files with 247 additions and 256 deletions

View File

@@ -7,15 +7,15 @@ import (
"git-indra.lan/indra-labs/indra/pkg/util/slice"
)
func (en *Engine) SendExit(port uint16, message slice.Bytes, id nonce.ID,
func (eng *Engine) SendExit(port uint16, message slice.Bytes, id nonce.ID,
target *traffic.Session, hook func(id nonce.ID, b slice.Bytes)) {
hops := []byte{0, 1, 2, 3, 4, 5}
s := make(traffic.Sessions, len(hops))
s[2] = target
se := en.Select(hops, s)
se := eng.SelectHops(hops, s)
var c traffic.Circuit
copy(c[:], se)
o := onion.SendExit(port, message, id, se[len(se)-1], c, en.KeySet)
en.SendOnion(c[0].AddrPort, o, hook)
o := onion.SendExit(port, message, id, se[len(se)-1], c, eng.KeySet)
eng.SendOnion(c[0].AddrPort, o, hook)
}