mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-12-25 16:05:27 +03:00
Merge branch 'alef-testnet-merge' into philip/mall-real
This commit is contained in:
commit
a5412f01de
@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:26d1409f39a9e551d7f694fc39b8e9a0d8b317caeca91a73285bdd6b717919ca
|
||||
size 9048500
|
||||
oid sha256:e12b39dc32d069ca48b1a67a908f026166757e4f8d4d452e1555812031beea18
|
||||
size 9670202
|
||||
|
@ -4,7 +4,7 @@ cp -r $src tmp
|
||||
chmod -R u+w tmp
|
||||
|
||||
ZUSE=tmp/sys/zuse.hoon
|
||||
AMES=tmp/sys/vane/ames.hoon
|
||||
ALEF=tmp/sys/vane/alef.hoon
|
||||
ACME=tmp/app/acme.hoon
|
||||
|
||||
# replace the mainnet azimuth contract with the ropsten contract
|
||||
@ -12,10 +12,10 @@ sed --in-place \
|
||||
's/\(\+\+ contracts \)mainnet\-contracts/\1ropsten-contracts/' \
|
||||
$ZUSE
|
||||
|
||||
# increment the %ames protocol version
|
||||
# increment the %alef protocol version
|
||||
sed -r --in-place \
|
||||
's/^(=\+ protocol\-version=)([0-9])/echo "\1$(echo "(\2+1) % 8" | bc)"/e' \
|
||||
$AMES
|
||||
's_^(=/ protocol\-version=\?\(.*\) %)([0-7])_echo "\1$(echo "(\2+1) % 8" | bc)"_e' \
|
||||
$ALEF
|
||||
|
||||
# use the staging API in :acme
|
||||
sed --in-place \
|
||||
|
@ -370,7 +370,7 @@
|
||||
%^ slum installed now.hid
|
||||
=/ vane
|
||||
?+ v ~|([%unknown-vane v] !!)
|
||||
%a %ames
|
||||
%a %alef
|
||||
%b %behn
|
||||
%c %clay
|
||||
%d %dill
|
||||
@ -440,7 +440,7 @@
|
||||
^- (list unix-event)
|
||||
:~ [/ %wack 0] :: eny
|
||||
[/ %whom who.ae] :: eny
|
||||
[//newt/0v1n.2m9vh %barn ~]
|
||||
[//newt/0v1n.2m9vh %born ~]
|
||||
[//behn/0v1n.2m9vh %born ~]
|
||||
:^ //term/1 %boot &
|
||||
?~ keys.ae
|
||||
|
80
pkg/arvo/app/ping.hoon
Normal file
80
pkg/arvo/app/ping.hoon
Normal file
@ -0,0 +1,80 @@
|
||||
/+ default-agent
|
||||
=* point point:able:kale
|
||||
::
|
||||
=> |%
|
||||
+$ card card:agent:gall
|
||||
:: +print-error: maybe +slog
|
||||
::
|
||||
++ print-error
|
||||
|= [=tape error=(unit tang)]
|
||||
^+ same
|
||||
?~ error same
|
||||
%- (slog leaf+tape u.error) same
|
||||
:: +set-timer: send a card to behn to set a timer
|
||||
::
|
||||
++ set-timer
|
||||
|= now=@da
|
||||
^- (list card)
|
||||
[%pass /ping-wait %arvo %b %wait `@da`(add ~s30 now)]~
|
||||
:: +send-ping: scry our sponsor from jael and poke their %ping app
|
||||
::
|
||||
++ send-ping
|
||||
|= [our=@p now=@da]
|
||||
^- (list card)
|
||||
::
|
||||
=/ sponsor=ship (sein:title our now our)
|
||||
::
|
||||
~> %slog.0^leaf/"ping: {<our>} -> {<sponsor>}"
|
||||
[%pass /ping-send %agent [sponsor %ping] %poke %noun !>(~)]~
|
||||
--
|
||||
^- agent:gall
|
||||
|_ =bowl:gall
|
||||
+* this .
|
||||
def ~(. (default-agent this %|) bowl)
|
||||
::
|
||||
:: +on-init: initializing on startup
|
||||
::
|
||||
++ on-init
|
||||
^- [(list card) _this]
|
||||
:: first load; galaxies no-op; everyone else pings sponsor
|
||||
::
|
||||
:_ this
|
||||
?: =(%czar (clan:title our.bowl))
|
||||
~
|
||||
~> %slog.0^leaf/"ping: prep {<our.bowl>}"
|
||||
(send-ping our.bowl now.bowl)
|
||||
::
|
||||
++ on-save on-save:def
|
||||
++ on-load on-load:def
|
||||
:: +on-poke: positively acknowledge pokes
|
||||
::
|
||||
++ on-poke
|
||||
|= [=mark =vase]
|
||||
`this
|
||||
::
|
||||
++ on-watch on-watch:def
|
||||
++ on-leave on-leave:def
|
||||
++ on-peek on-peek:def
|
||||
:: +on-agent: handle ames ack
|
||||
::
|
||||
++ on-agent
|
||||
|= [=wire =sign:agent:gall]
|
||||
^- [(list card) _this]
|
||||
?> ?=(%poke-ack -.sign)
|
||||
:_ this
|
||||
::
|
||||
%- (print-error "ping: ack" p.sign)
|
||||
(set-timer now.bowl)
|
||||
:: +on-arvo: handle timer firing
|
||||
::
|
||||
++ on-arvo
|
||||
|= [=wire =sign-arvo]
|
||||
^- [(list card) _this]
|
||||
?> ?=(%wake +<.sign-arvo)
|
||||
:_ this
|
||||
~! error.sign-arvo
|
||||
%- (print-error "ping: wake" error.sign-arvo)
|
||||
(send-ping our.bowl now.bowl)
|
||||
::
|
||||
++ on-fail on-fail:def
|
||||
--
|
@ -84,12 +84,14 @@
|
||||
%spider
|
||||
%eth-watcher
|
||||
%azimuth-tracker
|
||||
%ping
|
||||
==
|
||||
:~ %dojo
|
||||
%lens
|
||||
%eth-watcher
|
||||
%azimuth-tracker
|
||||
%clock
|
||||
%ping
|
||||
==
|
||||
:: %+ welp
|
||||
:: ?: ?=(%pawn (clan:title our)) ~
|
||||
|
@ -76,10 +76,6 @@
|
||||
+>.$
|
||||
(emit %pass / %arvo %j %moon u.sed)
|
||||
::
|
||||
++ poke-nuke :: initialize
|
||||
|= him/ship =< abet
|
||||
(emit %pass /helm %arvo %a %nuke him)
|
||||
::
|
||||
++ poke-mass
|
||||
|= ~ =< abet
|
||||
(flog %crud %hax-heft ~)
|
||||
@ -94,12 +90,6 @@
|
||||
|= ~
|
||||
abet:(emit %pass way.mass-timer.sez %arvo %b %rest nex.mass-timer.sez)
|
||||
::
|
||||
++ poke-bonk
|
||||
|= ~
|
||||
~& .^((unit @da) %a /(scot %p our)/time/(scot %da now)/(scot %p our))
|
||||
%- %- slog :_ ~ .^(tank %b /(scot %p our)/timers/(scot %da now))
|
||||
abet:(emit %pass /bonk %arvo %a %bonk ~)
|
||||
::
|
||||
++ take-wake-automass
|
||||
|= [way=wire error=(unit tang)]
|
||||
?^ error
|
||||
@ -207,9 +197,7 @@
|
||||
%helm-verb =;(f (f !<(_+<.f vase)) poke-verb)
|
||||
%helm-knob =;(f (f !<(_+<.f vase)) poke-knob)
|
||||
%helm-rekey =;(f (f !<(_+<.f vase)) poke-rekey)
|
||||
%helm-nuke =;(f (f !<(_+<.f vase)) poke-nuke)
|
||||
%helm-automass =;(f (f !<(_+<.f vase)) poke-automass)
|
||||
%helm-bonk =;(f (f !<(_+<.f vase)) poke-bonk)
|
||||
%helm-cancel-automass =;(f (f !<(_+<.f vase)) poke-cancel-automass)
|
||||
%helm-moon =;(f (f !<(_+<.f vase)) poke-moon)
|
||||
%helm-serve =;(f (f !<(_+<.f vase)) poke-serve)
|
||||
|
@ -304,8 +304,8 @@
|
||||
::
|
||||
++ poke-wash-gall |=(* abet:(emit %pass /kiln %arvo %g [%wash ~]))
|
||||
::
|
||||
++ mack
|
||||
|= {way/wire saw/(unit tang)}
|
||||
++ done
|
||||
|= {way/wire saw/(unit error:ames)}
|
||||
~? ?=(^ saw) [%kiln-nack u.saw]
|
||||
abet
|
||||
::
|
||||
@ -337,8 +337,8 @@
|
||||
?>(?=(%wake +<.sign-arvo) +>.sign-arvo)
|
||||
*
|
||||
?+ +<.sign-arvo ~|([%kiln-bad-take-card +<.sign-arvo] !!)
|
||||
%mack %+ mack wire
|
||||
?>(?=(%mack +<.sign-arvo) +>.sign-arvo)
|
||||
%done %+ done wire
|
||||
?>(?=(%done +<.sign-arvo) +>.sign-arvo)
|
||||
%made %+ take-made wire
|
||||
?>(?=(%made +<.sign-arvo) +>.sign-arvo)
|
||||
%mere %+ take-mere wire
|
||||
|
@ -25,9 +25,9 @@
|
||||
:~ :: sys/zuse: standard library
|
||||
::
|
||||
[%$ /zuse]
|
||||
:: sys/vane/ames: network
|
||||
:: sys/vane/alef: network
|
||||
::
|
||||
[%a /vane/ames]
|
||||
[%a /vane/alef]
|
||||
:: sys/vane/behn: timer
|
||||
::
|
||||
[%b /vane/behn]
|
||||
@ -49,7 +49,7 @@
|
||||
:: sys/vane/iris: http client
|
||||
::
|
||||
[%i /vane/iris]
|
||||
:: sys/vane/jael: security
|
||||
:: sys/vane/kale: security
|
||||
::
|
||||
[%j /vane/jael]
|
||||
==
|
||||
|
@ -349,8 +349,15 @@
|
||||
|= [our=@p now=@da ship=@p =life]
|
||||
^- @udpoint
|
||||
::
|
||||
=/ d=deed:ames
|
||||
.^(deed:ames j+/(scot %p our)/deed/(scot %da now)/(scot %p ship)/(scot %ud life))
|
||||
=/ d=[=^life =pass]
|
||||
=/ scry-path=path
|
||||
:~ %k
|
||||
(scot %p our)
|
||||
(scot %da now)
|
||||
(scot %p ship)
|
||||
(scot %ud life)
|
||||
==
|
||||
.^([^life pass] scry-path)
|
||||
:: we have the deed which has pass, which is several numbers +cat-ed
|
||||
:: together; pull out the keys
|
||||
::
|
||||
@ -370,7 +377,7 @@
|
||||
[participants keys]
|
||||
::
|
||||
=/ =life
|
||||
.^(life j+/(scot %p our)/life/(scot %da now)/(scot %p i.invited))
|
||||
.^(life k+/(scot %p our)/life/(scot %da now)/(scot %p i.invited))
|
||||
::
|
||||
?: =(life 0)
|
||||
$(invited t.invited)
|
||||
@ -429,11 +436,11 @@
|
||||
:: get our ships' current life
|
||||
::
|
||||
=/ our-life=life
|
||||
.^(life %j /(scot %p our)/life/(scot %da now)/(scot %p our))
|
||||
.^(life %k /(scot %p our)/life/(scot %da now)/(scot %p our))
|
||||
:: get our ships' secret keyfile ring
|
||||
::
|
||||
=/ secret-ring=ring
|
||||
.^(ring %j /(scot %p our)/vein/(scot %da now)/(scot %ud our-life))
|
||||
.^(ring %k /(scot %p our)/vein/(scot %da now)/(scot %ud our-life))
|
||||
:: fetch the encoded auth seed from the ring
|
||||
::
|
||||
=/ secret-auth-seed=@
|
||||
|
@ -256,14 +256,9 @@
|
||||
++ slur-e ~/(%slur-e |=({gat/vase hil/mill} =+(%e (slur gat hil))))
|
||||
++ slur-f ~/(%slur-f |=({gat/vase hil/mill} =+(%f (slur gat hil))))
|
||||
++ slur-g ~/(%slur-g |=({gat/vase hil/mill} =+(%g (slur gat hil))))
|
||||
++ slur-i ~/(%slur-i |=({gat/vase hil/mill} =+(%i (slur gat hil))))
|
||||
++ slur-j ~/(%slur-j |=({gat/vase hil/mill} =+(%j (slur gat hil))))
|
||||
++ slur-z ~/(%slur-z |=({gat/vase hil/mill} =+(%z (slur gat hil))))
|
||||
++ slur-r
|
||||
~/ %slur-r
|
||||
|=({gat/vase hil/mill} =+(%r (slur gat hil)))
|
||||
++ slur-l
|
||||
~/ %slur-l
|
||||
|=({gat/vase hil/mill} =+(%l (slur gat hil)))
|
||||
::
|
||||
++ slur-pro :: profiling slur
|
||||
~/ %slur-pro
|
||||
@ -276,10 +271,8 @@
|
||||
$e (slur-e gat hil)
|
||||
$f (slur-f gat hil)
|
||||
$g (slur-g gat hil)
|
||||
$i (slur-i gat hil)
|
||||
$j (slur-j gat hil)
|
||||
::
|
||||
%l (slur-l gat hil)
|
||||
%r (slur-r gat hil)
|
||||
==
|
||||
::
|
||||
++ song :: reduce metacard
|
||||
|
@ -11981,7 +11981,7 @@
|
||||
^= gen ^- hoon
|
||||
[%cnsg [%$ ~] [%$ 2] [%$ 3] ~]
|
||||
=+ gun=(~(mint ut typ) %noun gen)
|
||||
[p.gun .*([q.gat q.sam] q.gun)]
|
||||
[p.gun (slum q.gat q.sam)]
|
||||
::
|
||||
++ slab :: test if contains
|
||||
|= {cog/@tas typ/type}
|
||||
@ -14386,44 +14386,49 @@
|
||||
~> %slog.[0 foo]
|
||||
[| +>+<.$]
|
||||
[& +>+<.$(nes (~(put in nes) [sut ref]))]
|
||||
:: +play: +play:ut, cached
|
||||
::
|
||||
++ play :: play:ut
|
||||
++ play
|
||||
|= {sut/type gen/hoon}
|
||||
^- {type worm}
|
||||
=+ old=(~(get by pay) [sut gen])
|
||||
?^ old [u.old +>+<.$]
|
||||
=+ new=(~(play ut sut) gen)
|
||||
[new +>+<.$(pay (~(put by pay) [sut gen] new))]
|
||||
:: +mint: +mint:ut to noun, cached
|
||||
::
|
||||
++ mint :: mint:ut to noun
|
||||
++ mint
|
||||
|= {sut/type gen/hoon}
|
||||
^- {(pair type nock) worm}
|
||||
=+ old=(~(get by mit) [sut gen])
|
||||
?^ old [u.old +>+<.$]
|
||||
=+ new=(~(mint ut sut) %noun gen)
|
||||
[new +>+<.$(mit (~(put by mit) [sut gen] new))]
|
||||
:: +slam: +slam:ut, cached
|
||||
::
|
||||
++ slam :: ++slam, cached
|
||||
++ slam
|
||||
|= [gat=vase sam=vase]
|
||||
^- [vase worm]
|
||||
=/ sut=type [%cell p.gat p.sam]
|
||||
=/ gen=hoon [%cnsg [%$ ~] [%$ 2] [%$ 3] ~]
|
||||
=^ new=type +>+<.$ (play sut gen)
|
||||
[[new (slum q.gat q.sam)] +>+<.$]
|
||||
:: +slap: +slap:ut, cached
|
||||
::
|
||||
++ slap :: ++slap, cached
|
||||
++ slap
|
||||
|= {vax/vase gen/hoon}
|
||||
^- {vase worm}
|
||||
=^ gun +>+< (mint p.vax gen)
|
||||
[[p.gun .*(q.vax q.gun)] +>+<.$]
|
||||
:: +slot: +slot:ut, cached
|
||||
::
|
||||
++ slot :: ++slot, cached
|
||||
++ slot
|
||||
|= {axe/@ vax/vase}
|
||||
^- {vase worm}
|
||||
=^ gun +>+< (mint p.vax [%$ axe])
|
||||
[[p.gun .*(q.vax [0 axe])] +>+<.$]
|
||||
:: +slym: +slym:ut, cached
|
||||
::
|
||||
++ slym :: ++slym, cached
|
||||
++ slym
|
||||
|= {gat/vase sam/*}
|
||||
^- [vase worm]
|
||||
(slap gat(+<.q sam) [%limb %$])
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -470,7 +470,7 @@
|
||||
++ note :: out request $->
|
||||
$~ [%b %wait *@da] ::
|
||||
$% $: %a :: to %ames
|
||||
$>(%want task:able:ames) ::
|
||||
$>(%plea task:able:ames) ::
|
||||
== ::
|
||||
$: %b :: to %behn
|
||||
$> $? %drip ::
|
||||
@ -507,8 +507,9 @@
|
||||
$% [%init-clad ~] ::
|
||||
== == ::
|
||||
$: %a :: by %ames
|
||||
$> $? %send :: XX strange
|
||||
%woot ::
|
||||
$> $? %boon :: response
|
||||
%done :: (n)ack
|
||||
%lost :: lost boon
|
||||
== ::
|
||||
gift:able:ames ::
|
||||
== ::
|
||||
@ -2786,8 +2787,13 @@
|
||||
:: Transfer a request to another ship's clay.
|
||||
::
|
||||
++ send-over-ames
|
||||
|= {a/duct b/path c/ship d/{p/@ud q/riff}}
|
||||
(emit a %pass b %a %want c [%c %question p.q.d (scot %ud p.d) ~] q.d)
|
||||
|= [=duct =ship index=@ud =riff]
|
||||
^+ +>
|
||||
::
|
||||
=/ =desk p.riff
|
||||
=/ =wire /warp-index/(scot %p ship)/(scot %tas desk)/(scot %ud index)
|
||||
=/ =path [%question desk (scot %ud index) ~]
|
||||
(emit duct %pass wire %a %plea ship %c path riff)
|
||||
::
|
||||
:: Create a request that cannot be filled immediately.
|
||||
::
|
||||
@ -2811,7 +2817,7 @@
|
||||
=+ inx=nix.u.ref
|
||||
=. +>+.$
|
||||
=< ?>(?=(^ ref) .)
|
||||
(send-over-ames hen [(scot %ud inx) ~] her inx syd ~ rave)
|
||||
(send-over-ames hen her inx syd `rave)
|
||||
%= +>+.$
|
||||
nix.u.ref +(nix.u.ref)
|
||||
bom.u.ref (~(put by bom.u.ref) inx [hen rave])
|
||||
@ -2909,12 +2915,21 @@
|
||||
?: |(?=(%& -.w) (~(has by cez) p.w)) s
|
||||
(~(put in s) p.w)
|
||||
?^ mis
|
||||
=- (emit hen %give %mack `[%leaf "No such group(s): {-}"]~)
|
||||
:: TODO remove this nasty hack
|
||||
::
|
||||
?. ?=([[%a *] *] hen)
|
||||
+>.$
|
||||
=- (emit hen %give %done `[%perm-fail [%leaf "No such group(s): {-}"]~])
|
||||
%+ roll ~(tap in `(set @ta)`mis)
|
||||
|= {g/@ta t/tape}
|
||||
?~ t (trip g)
|
||||
:(weld t ", " (trip g))
|
||||
=< (emit hen %give %mack ~)
|
||||
:: TODO remove this nasty hack
|
||||
::
|
||||
=< ?. ?=([[%a *] *] hen)
|
||||
.
|
||||
(emit hen %give %done ~)
|
||||
::
|
||||
?- -.rit
|
||||
$r wake(per (put-perm per pax red.rit))
|
||||
$w wake(pew (put-perm pew pax wit.rit))
|
||||
@ -2965,7 +2980,7 @@
|
||||
=: fod.u.ref (~(del by fod.u.ref) hen)
|
||||
bom.u.ref (~(del by bom.u.ref) u.nux)
|
||||
==
|
||||
(send-over-ames hen [(scot %ud u.nux) ~] her u.nux syd ~)
|
||||
(send-over-ames hen her u.nux syd ~)
|
||||
::
|
||||
:: Handles a request.
|
||||
::
|
||||
@ -4033,7 +4048,7 @@
|
||||
::
|
||||
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
||||
=| :: instrument state
|
||||
$: ver=%1 :: vane version
|
||||
$: ver=%2 :: vane version
|
||||
ruf=raft :: revision tree
|
||||
== ::
|
||||
|= [our=ship now=@da eny=@uvJ ski=sley] :: current invocation
|
||||
@ -4106,7 +4121,7 @@
|
||||
=| mos/(list move)
|
||||
=/ des ~(tap in ~(key by dos.rom.ruf))
|
||||
|-
|
||||
?~ des [[[hen %give %mack ~] mos] ..^^$]
|
||||
?~ des [[[hen %give %done ~] mos] ..^^$]
|
||||
=/ den ((de our now ski hen ruf) our i.des)
|
||||
=^ mor ruf
|
||||
=< abet:wake
|
||||
@ -4317,25 +4332,19 @@
|
||||
(start-request:den for u.q.rif)
|
||||
[mos ..^$]
|
||||
::
|
||||
%west
|
||||
=* wer p.req
|
||||
=* pax q.req
|
||||
=* res r.req
|
||||
?: ?=({%question *} pax)
|
||||
%plea
|
||||
=* her ship.req
|
||||
=* pax path.plea.req
|
||||
=* res payload.plea.req
|
||||
::
|
||||
?> ?=({%question *} pax)
|
||||
=+ ryf=;;(riff res)
|
||||
:_ ..^$
|
||||
:~ [hen %give %mack ~]
|
||||
:~ [hen %give %done ~]
|
||||
=/ =wire
|
||||
[(scot %p our) (scot %p wer) t.pax]
|
||||
[hen %pass wire %c %werp wer our ryf]
|
||||
[%foreign-warp (scot %p her) t.pax]
|
||||
[hen %pass wire %c %werp her our ryf]
|
||||
==
|
||||
?> ?=({%answer @ @ ~} pax)
|
||||
=+ syd=(slav %tas i.t.pax)
|
||||
=+ inx=(slav %ud i.t.t.pax)
|
||||
=^ mos ruf
|
||||
=/ den ((de our now ski hen ruf) wer syd)
|
||||
abet:(take-foreign-answer:den inx ;;((unit rand) res))
|
||||
[[[hen %give %mack ~] mos] ..^$]
|
||||
::
|
||||
%wegh
|
||||
:_ ..^$ :_ ~
|
||||
@ -4353,208 +4362,8 @@
|
||||
::
|
||||
++ load
|
||||
!:
|
||||
=> |%
|
||||
+$ axle
|
||||
$% [%1 ruf-1=raft-1]
|
||||
[%2 ruf-2=raft]
|
||||
==
|
||||
+$ raft-1
|
||||
$: rom=room
|
||||
hoy=(map ship rung-1)
|
||||
ran=rang
|
||||
mon=(map term beam)
|
||||
hez=(unit duct)
|
||||
cez=(map @ta crew)
|
||||
cue=(qeu [=duct =task:able])
|
||||
act=active-write-1
|
||||
==
|
||||
::
|
||||
+$ rung-1
|
||||
$: rit=rift
|
||||
rus=(map desk rede-1)
|
||||
==
|
||||
::
|
||||
+$ rede-1
|
||||
$: lim=@da
|
||||
ref=(unit rind-1)
|
||||
qyx=cult
|
||||
dom=dome
|
||||
per=regs
|
||||
pew=regs
|
||||
==
|
||||
::
|
||||
+$ rind-1
|
||||
$: nix=@ud
|
||||
bom=(map @ud {p/duct q/rave})
|
||||
fod=(map duct @ud)
|
||||
haw=(map mood (unit cage))
|
||||
pud=update-qeu-1
|
||||
pur=request-map-1
|
||||
==
|
||||
::
|
||||
+$ update-qeu-1
|
||||
$: waiting=(qeu [inx=@ud rut=(unit rand)])
|
||||
$= eval-data
|
||||
%- unit
|
||||
$: inx=@ud
|
||||
rut=(unit rand)
|
||||
form=(eval-form-1 (unit [lim=@da dome rang]))
|
||||
==
|
||||
==
|
||||
::
|
||||
+$ request-map-1
|
||||
(map inx=@ud [=rand (eval-form-1 cage)])
|
||||
::
|
||||
+$ active-write-1
|
||||
%- unit
|
||||
$: hen=duct
|
||||
req=task:able
|
||||
$= eval-data
|
||||
$% [%commit form=(eval-form-1 [dome rang])]
|
||||
[%merge form=(eval-form-1 [(set path) dome rang])]
|
||||
[%mount form=(eval-form-1 [(pair term beam) (map path mime)])]
|
||||
==
|
||||
==
|
||||
::
|
||||
++ eval-form-1
|
||||
|* a=mold
|
||||
,[effects=(list move) form=(clad-form-1 a)]
|
||||
::
|
||||
++ clad-form-1
|
||||
|* a=mold
|
||||
$-([@da rang sign-1] (clad-output-1 a))
|
||||
::
|
||||
++ clad-output-1
|
||||
|* a=mold
|
||||
$~ [~ ~ %done *a]
|
||||
$: notes=(list [path note])
|
||||
effects=(list move)
|
||||
$= next
|
||||
$% [%wait ~]
|
||||
[%cont self=(clad-form-1 a)]
|
||||
[%fail err=(pair term tang)]
|
||||
[%done value=a]
|
||||
==
|
||||
==
|
||||
::
|
||||
++ sign-1
|
||||
$~ [%b %wake ~]
|
||||
$% $: %y
|
||||
$% [%init-clad ~]
|
||||
== ==
|
||||
$: %a
|
||||
$> $? %send
|
||||
%woot
|
||||
==
|
||||
gift:able:ames
|
||||
==
|
||||
$: %b
|
||||
$% $>(%wake gift:able:behn)
|
||||
$>(%writ gift:able)
|
||||
== ==
|
||||
$: %c
|
||||
$> $? %mere
|
||||
%note
|
||||
%writ
|
||||
==
|
||||
gift:able
|
||||
==
|
||||
$: %f
|
||||
$>(%made gift:able:ford)
|
||||
==
|
||||
$: %j
|
||||
[%public-keys =public-keys-result-1]
|
||||
==
|
||||
$: @tas
|
||||
$>(%crud vane-task)
|
||||
== ==
|
||||
::
|
||||
+$ public-keys-result-1
|
||||
$% [%full points=(map ship point:able:jael)]
|
||||
[%diff who=ship =diff:point:able:jael]
|
||||
==
|
||||
::
|
||||
++ upgrade-1
|
||||
|= ruf=raft-1
|
||||
^- axle
|
||||
:- %2
|
||||
%= ruf
|
||||
act
|
||||
?~ act.ruf
|
||||
~
|
||||
:- ~
|
||||
%= u.act.ruf
|
||||
eval-data
|
||||
?- -.eval-data.u.act.ruf
|
||||
%commit
|
||||
:- %commit
|
||||
%- (upgrade-clad-1 ,[dome rang])
|
||||
form.eval-data.u.act.ruf
|
||||
::
|
||||
%merge
|
||||
:- %merge
|
||||
%- (upgrade-clad-1 ,[(set path) dome rang])
|
||||
form.eval-data.u.act.ruf
|
||||
::
|
||||
%mount
|
||||
:- %mount
|
||||
%- (upgrade-clad-1 ,[(pair term beam) (map path mime)])
|
||||
form.eval-data.u.act.ruf
|
||||
==
|
||||
==
|
||||
::
|
||||
hoy
|
||||
^- (map ship rung)
|
||||
%- ~(urn by hoy.ruf)
|
||||
|= [her=ship rift rus=(map desk rede-1)]
|
||||
^- rung
|
||||
%- ~(urn by rus)
|
||||
|= [syd=desk red=rede-1]
|
||||
^- rede
|
||||
?~ ref.red
|
||||
red
|
||||
%= red
|
||||
u.ref
|
||||
^- rind
|
||||
%= u.ref.red
|
||||
pud
|
||||
^- update-qeu
|
||||
?~ eval-data.pud.u.ref.red
|
||||
pud.u.ref.red
|
||||
%= pud.u.ref.red
|
||||
form.u.eval-data
|
||||
%- (upgrade-clad-1 ,(unit [lim=@da dome rang]))
|
||||
form.u.eval-data.pud.u.ref.red
|
||||
==
|
||||
::
|
||||
pur
|
||||
%- ~(urn by pur.u.ref.red)
|
||||
|= [inx=@ud =rand form=(eval-form-1 ,cage)]
|
||||
[rand ((upgrade-clad-1 ,cage) form)]
|
||||
==
|
||||
==
|
||||
==
|
||||
::
|
||||
++ upgrade-clad-1
|
||||
|* a=mold
|
||||
|= e-form=(eval-form-1 a)
|
||||
:- effects.e-form
|
||||
^+ *form:(clad ,a)
|
||||
|= cin=clad-input
|
||||
?: ?=([%j %public-keys %breach *] sign.cin)
|
||||
[~ ~ %wait ~]
|
||||
=/ res (form.e-form cin)
|
||||
?: ?=(%cont -.next.res)
|
||||
res(self.next ..$(form.e-form self.next.res))
|
||||
res
|
||||
--
|
||||
::
|
||||
|= old=axle
|
||||
^+ ..^$
|
||||
=? old ?=(%1 -.old)
|
||||
(upgrade-1 ruf-1.old)
|
||||
?> ?=(%2 -.old)
|
||||
%_(..^$ ruf ruf-2.old)
|
||||
|= [%2 =raft]
|
||||
..^$(ruf raft)
|
||||
::
|
||||
++ scry :: inspect
|
||||
|= {fur/(unit (set monk)) ren/@tas why/shop syd/desk lot/coin tyl/path}
|
||||
@ -4584,7 +4393,7 @@
|
||||
?: ?=(%& -.u.u.-) ``p.u.u.-
|
||||
~
|
||||
::
|
||||
++ stay [%2 ruf]
|
||||
++ stay [ver ruf]
|
||||
++ take :: accept response
|
||||
|= [tea=wire hen=duct hin=(hypo sign)]
|
||||
^+ [*(list move) ..^$]
|
||||
@ -4609,6 +4418,11 @@
|
||||
abet:(take-mount:den q.hin)
|
||||
[mos ..^$]
|
||||
::
|
||||
?: ?=([%foreign-warp *] tea)
|
||||
?> ?=(%writ +<.q.hin)
|
||||
:_ ..^$
|
||||
[hen %give %boon `(unit rand)`(bind `riot`p.q.hin rant-to-rand)]~
|
||||
::
|
||||
?: ?=([%foreign-request @ @ @ *] tea)
|
||||
=/ her (slav %p i.t.tea)
|
||||
=/ syd (slav %tas i.t.t.tea)
|
||||
@ -4642,6 +4456,35 @@
|
||||
`cage`(result-to-cage:ford build-result.result.q.hin)
|
||||
== ==
|
||||
::
|
||||
?: ?=([%warp-index @ @ @ ~] tea)
|
||||
?+ +<.q.hin ~| %clay-warp-index-strange !!
|
||||
%done
|
||||
?~ error.q.hin
|
||||
[~ ..^$]
|
||||
:: TODO better error handling
|
||||
::
|
||||
~& %clay-take-warp-index-error^our^tea^tag.u.error.q.hin
|
||||
%- (slog tang.u.error.q.hin)
|
||||
[~ ..^$]
|
||||
::
|
||||
%lost
|
||||
~| %clay-take-lost^our
|
||||
:: TODO better error handling
|
||||
!!
|
||||
::
|
||||
%boon
|
||||
=+ ;; res=(unit rand) payload.q.hin
|
||||
::
|
||||
=/ her=ship (slav %p i.t.tea)
|
||||
=/ =desk (slav %tas i.t.t.tea)
|
||||
=/ index=@ud (slav %ud i.t.t.t.tea)
|
||||
::
|
||||
=^ mos ruf
|
||||
=/ den ((de our now ski hen ruf) her desk)
|
||||
abet:(take-foreign-answer:den index res)
|
||||
[mos ..^$]
|
||||
==
|
||||
::
|
||||
?: ?=([%sinks ~] tea)
|
||||
?> ?=(%public-keys +<.q.hin)
|
||||
?. ?=(%breach -.public-keys-result.q.hin)
|
||||
@ -4731,28 +4574,16 @@
|
||||
::
|
||||
(handle-task hen queued-task)
|
||||
::
|
||||
%writ
|
||||
?> ?=({@ @ *} tea)
|
||||
~| i=i.tea
|
||||
~| it=i.t.tea
|
||||
=+ him=(slav %p i.t.tea)
|
||||
:_ ..^$
|
||||
:~ :* hen %pass /writ-want %a
|
||||
%want him [%c %answer t.t.tea]
|
||||
(bind p.+.q.hin rant-to-rand)
|
||||
==
|
||||
==
|
||||
:: handled in the wire dispatcher
|
||||
::
|
||||
%send
|
||||
[[[hen %give +.q.hin] ~] ..^$]
|
||||
%boon !!
|
||||
%lost !!
|
||||
%writ !!
|
||||
::
|
||||
%woot
|
||||
?~ q.q.hin
|
||||
%done
|
||||
?~ error=error.q.hin
|
||||
[~ ..^$]
|
||||
~& [%clay-lost p.q.hin tea]
|
||||
?~ u.q.q.hin
|
||||
[~ ..^$]
|
||||
%- (slog >p.u.u.q.q.hin< q.u.u.q.q.hin)
|
||||
%- (slog >%clay-lost< >tag.u.error< tang.u.error)
|
||||
[~ ..^$]
|
||||
==
|
||||
::
|
||||
|
@ -98,11 +98,7 @@
|
||||
++ sign :: in result $<-
|
||||
$~ [%j %init *@p] ::
|
||||
$% $: %a ::
|
||||
$% [%nice ~] :: XX obsolete
|
||||
$> $? %mass ::
|
||||
%send :: XX strange
|
||||
== ::
|
||||
gift:able:ames ::
|
||||
$% $>(%mass gift:able:ames) ::
|
||||
== == ::
|
||||
$: %b ::
|
||||
$% $> $? %mass ::
|
||||
@ -113,8 +109,7 @@
|
||||
$>(%mere gift:able:clay) :: XX %slip
|
||||
== == ::
|
||||
$: %c ::
|
||||
$> $? %mack :: XX strange
|
||||
%mass ::
|
||||
$> $? %mass ::
|
||||
%mere ::
|
||||
%note ::
|
||||
%writ ::
|
||||
@ -409,27 +404,17 @@
|
||||
++ autoload
|
||||
(deal /autoload [%poke %kiln-start-autoload [%atom %n `~] ~])
|
||||
::
|
||||
++ pump :: send diff ack
|
||||
(deal / [%pump ~])
|
||||
::
|
||||
++ take :: receive
|
||||
|= {tea/wire sih/sign}
|
||||
^+ +>
|
||||
?- sih
|
||||
{?($a $b $c $e $f $g $i $j) $mass *}
|
||||
(wegh -.sih p.sih)
|
||||
::
|
||||
{$a $nice *}
|
||||
:: ~& [%take-nice-ames sih]
|
||||
+>
|
||||
::
|
||||
[%j %init *]
|
||||
:: pass thru to unix
|
||||
::
|
||||
+>(moz :_(moz [hen %give +.sih]))
|
||||
::
|
||||
{$a $send *}
|
||||
+>(moz :_(moz [hen %give +.sih]))
|
||||
::
|
||||
{$g $onto *}
|
||||
:: ~& [%take-gall-onto +>.sih]
|
||||
@ -446,7 +431,7 @@
|
||||
$watch-ack ?~ p.p.+>.sih
|
||||
+>.$
|
||||
(dump:(crud %reap u.p.p.+>.sih) %logo ~)
|
||||
$fact pump:(from ;;(dill-blit q:`vase`+>+>.sih))
|
||||
$fact (from ;;(dill-blit q:`vase`+>+>.sih))
|
||||
==
|
||||
::
|
||||
{$c $note *}
|
||||
@ -459,10 +444,6 @@
|
||||
?: ?=(%& -.p.sih)
|
||||
mere
|
||||
(mean >%dill-mere-fail< >p.p.p.sih< q.p.p.sih)
|
||||
::
|
||||
{$c $mack *}
|
||||
?~ p.sih +>.$
|
||||
(mean >%dill-clay-nack< u.p.sih)
|
||||
::
|
||||
{$d $blit *}
|
||||
(done +.sih)
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -62,8 +62,10 @@
|
||||
+$ message :: message to her jael
|
||||
$% [%nuke whos=(set ship)] :: cancel trackers
|
||||
[%public-keys whos=(set ship)] :: view ethereum events
|
||||
[%public-keys-result =public-keys-result] ::
|
||||
== ::
|
||||
+$ message-result
|
||||
$% [%public-keys-result =public-keys-result] :: public keys boon
|
||||
==
|
||||
+$ card :: i/o action
|
||||
(wind note gift) ::
|
||||
:: ::
|
||||
@ -71,9 +73,9 @@
|
||||
[p=duct q=card] ::
|
||||
:: ::
|
||||
+$ note :: out request $->
|
||||
$~ [%a %want *ship *path **] ::
|
||||
$~ [%a %plea *ship *plea:ames] ::
|
||||
$% $: %a :: to %ames
|
||||
$>(%want task:able:ames) :: send message
|
||||
$>(%plea task:able:ames) :: send request message
|
||||
== ::
|
||||
$: %g :: to self
|
||||
$>(%deal task:able:gall) :: set ethereum source
|
||||
@ -88,8 +90,12 @@
|
||||
+$ peer-sign [=ship =udiff:point] ::
|
||||
:: ::
|
||||
+$ sign :: in result $<-
|
||||
$~ [%a %woot *ship ~] ::
|
||||
$% [%a $>(%woot gift:able:ames)] :: message result
|
||||
$~ [%a %done ~] ::
|
||||
$% $: %a
|
||||
$% $>(%boon gift:able:ames) :: message response
|
||||
$>(%done gift:able:ames) :: message (n)ack
|
||||
$>(%lost gift:able:ames) :: lost boon
|
||||
== ==
|
||||
$: %g ::
|
||||
$> $? %onto ::
|
||||
%unto ::
|
||||
@ -488,32 +494,24 @@
|
||||
:: authenticated remote request
|
||||
:: {$west p/ship q/path r/*}
|
||||
::
|
||||
$west
|
||||
=* her p.tac
|
||||
=/ mes (message r.tac)
|
||||
%plea
|
||||
=* her ship.tac
|
||||
=/ mes ;;(message payload.plea.tac)
|
||||
?- -.mes
|
||||
::
|
||||
:: cancel trackers
|
||||
:: [%nuke whos=(set ship)]
|
||||
::
|
||||
%nuke
|
||||
=. moz [[hen %give %mack ~] moz]
|
||||
=. moz [[hen %give %done ~] moz]
|
||||
$(tac mes)
|
||||
::
|
||||
:: view ethereum events
|
||||
:: [%public-keys whos=(set ship)]
|
||||
::
|
||||
%public-keys
|
||||
=. moz [[hen %give %mack ~] moz]
|
||||
=. moz [[hen %give %done ~] moz]
|
||||
$(tac mes)
|
||||
::
|
||||
:: receive keys result
|
||||
:: [%public-keys-result =public-keys-result]
|
||||
::
|
||||
%public-keys-result
|
||||
=. moz [[hen %give %mack ~] moz]
|
||||
%- curd =< abet
|
||||
(public-keys:~(feel su hen our pki etn) public-keys-result.mes)
|
||||
==
|
||||
==
|
||||
::
|
||||
@ -521,13 +519,23 @@
|
||||
|= [tea=wire hen=duct hin=sign]
|
||||
^+ +>
|
||||
?- hin
|
||||
[%a %woot *]
|
||||
?~ q.hin +>.$
|
||||
?~ u.q.hin ~&(%ares-fine +>.$)
|
||||
~& [%woot-bad p.u.u.q.hin]
|
||||
~_ q.u.u.q.hin
|
||||
[%a %done *]
|
||||
?~ error.hin ~&(%ares-fine +>.$)
|
||||
~& [%done-bad tag.u.error.hin]
|
||||
%- (slog tang.u.error.hin)
|
||||
::TODO fail:et
|
||||
+>.$
|
||||
::
|
||||
[%a %boon *]
|
||||
=+ ;; [%public-keys-result =public-keys-result] payload.hin
|
||||
%- curd =< abet
|
||||
(public-keys:~(feel su hen our pki etn) public-keys-result)
|
||||
::
|
||||
[%a %lost *]
|
||||
:: TODO: better error handling
|
||||
::
|
||||
~| %jael-ames-lost
|
||||
!!
|
||||
::
|
||||
[%g %onto *]
|
||||
~& [%jael-onto tea hin]
|
||||
@ -551,10 +559,7 @@
|
||||
$fact
|
||||
?> ?=([@ *] tea)
|
||||
=* app i.tea
|
||||
~! +>.hin
|
||||
=/ =peer-sign ;;(peer-sign q.q.cage.p.+>.hin)
|
||||
%. [hen tea app]
|
||||
=< pump
|
||||
%- curd =< abet
|
||||
(~(new-event su hen our pki etn) peer-sign)
|
||||
==
|
||||
@ -566,10 +571,6 @@
|
||||
etn/state-eth-node
|
||||
==
|
||||
+>(pki pki, etn etn, moz (weld (flop moz) ^moz))
|
||||
:: :: ++wind:of
|
||||
++ pump
|
||||
|= [hen=duct =wire app=term]
|
||||
(emit [hen %pass wire %g %deal [our our] app %pump ~])
|
||||
--
|
||||
:: :: ++su
|
||||
:::: ## relative^heavy :: subjective engine
|
||||
@ -645,15 +646,8 @@
|
||||
?. &(?=([[%a @ @ *] *] d) !=(%pubs i.t.i.d))
|
||||
%- emit
|
||||
[d %give %public-keys public-keys-result]
|
||||
=/ our (slav %p i.t.i.d)
|
||||
=/ who (slav %p i.t.t.i.d)
|
||||
=/ =message [%public-keys-result public-keys-result]
|
||||
%- emit
|
||||
:^ d
|
||||
%pass
|
||||
/public-keys-result
|
||||
^- note
|
||||
[%a %want who /j/public-keys-result message]
|
||||
[d %give %boon %public-keys-result public-keys-result]
|
||||
$(yez t.yez)
|
||||
::
|
||||
++ get-source
|
||||
@ -884,7 +878,7 @@
|
||||
?: ?=(%& -.source)
|
||||
=/ send-message
|
||||
|= =message
|
||||
[hen %pass /public-keys %a %want p.source /j/public-keys message]
|
||||
[hen %pass /public-keys %a %plea p.source %j /public-keys message]
|
||||
(emit (send-message %public-keys whos))
|
||||
=^ =source-id this-su (get-source-id source)
|
||||
=. ..feed
|
||||
@ -1047,7 +1041,7 @@
|
||||
?: fak.own.pki.lex
|
||||
=/ cub (pit:nu:crub:crypto 512 u.who)
|
||||
:^ ~ ~ %noun
|
||||
!> `deed:ames`[1 pub:ex:cub ~]
|
||||
!> [1 pub:ex:cub ~]
|
||||
::
|
||||
=/ rac (clan:title u.who)
|
||||
?: ?=(%pawn rac)
|
||||
@ -1059,8 +1053,7 @@
|
||||
=/ cub (nol:nu:crub:crypto sec)
|
||||
=/ sig (sign:as:cub (shaf %self (sham [u.who 1 pub:ex:cub])))
|
||||
:^ ~ ~ %noun
|
||||
!> ^- deed:ames
|
||||
[1 pub:ex:cub `sig]
|
||||
!> [1 pub:ex:cub `sig]
|
||||
::
|
||||
=/ pub (~(get by pos.zim.pki.lex) u.who)
|
||||
?~ pub
|
||||
@ -1071,7 +1064,7 @@
|
||||
?~ pas
|
||||
~
|
||||
:^ ~ ~ %noun
|
||||
!> `deed:ames`[u.lyf pass.u.pas ~]
|
||||
!> [u.lyf pass.u.pas ~]
|
||||
::
|
||||
%earl
|
||||
?. ?=([@ @ ~] tyl) [~ ~]
|
||||
|
@ -1,3 +1,4 @@
|
||||
!:
|
||||
:: :: /van/zuse
|
||||
:: :: %reference/1
|
||||
:: %zuse: arvo library.
|
||||
@ -194,6 +195,7 @@
|
||||
:: +vane-task: general tasks shared across vanes
|
||||
::
|
||||
+$ vane-task
|
||||
$~ [%born ~]
|
||||
$% :: i/o device replaced (reset state)
|
||||
::
|
||||
[%born ~]
|
||||
@ -214,7 +216,9 @@
|
||||
[%wegh ~]
|
||||
:: receive message via %ames
|
||||
::
|
||||
[%west p=ship q=path r=*]
|
||||
:: TODO: move .vane from $plea to here
|
||||
::
|
||||
[%plea =ship =plea:ames]
|
||||
==
|
||||
:: ::::
|
||||
:::: ++http ::
|
||||
@ -374,32 +378,62 @@
|
||||
:: ::::
|
||||
++ able ^?
|
||||
|%
|
||||
++ gift :: out result <-$
|
||||
$% {$mack p/(unit tang)} :: acknowledgement
|
||||
{$mass p/mass} :: memory usage
|
||||
{$send p/lane q/@} :: transmit packet
|
||||
{$turf p/(list turf)} :: bind to domains
|
||||
$>(%west vane-task) :: for the outside
|
||||
{$woot p/ship q/coop} :: reaction message
|
||||
== ::
|
||||
++ task :: in request ->$
|
||||
$~ [%vega ~] ::
|
||||
$% {$barn ~} :: new unix process
|
||||
{$bonk ~} :: reset the timer
|
||||
$>(%crud vane-task) :: error with trace
|
||||
{$hear p/lane q/@} :: receive packet
|
||||
{$halo p/lane q/@ r/ares} :: hole with trace
|
||||
{$hole p/lane q/@} :: packet failed
|
||||
$>(%init vane-task) :: report install
|
||||
{$kick p/@da} :: wake up
|
||||
{$nuke p/@p} :: toggle auto-block
|
||||
$>(%trim vane-task) :: trim state
|
||||
$>(%vega vane-task) :: report upgrade
|
||||
{$wake ~} :: timer activate
|
||||
$>(%wegh vane-task) :: report memory
|
||||
$>(%west vane-task) :: network request
|
||||
{$want p/ship q/path r/*} :: forward message
|
||||
== ::
|
||||
:: $task: job for ames
|
||||
::
|
||||
:: Messaging Tasks
|
||||
::
|
||||
:: %hear: packet from unix
|
||||
:: %hole: report that packet handling crashed
|
||||
:: %heed: track peer's responsiveness; gives %clog if slow
|
||||
:: %jilt: stop tracking peer's responsiveness
|
||||
:: %plea: request to send message
|
||||
::
|
||||
:: System and Lifecycle Tasks
|
||||
::
|
||||
:: %born: process restart notification
|
||||
:: %crud: crash report
|
||||
:: %init: vane boot
|
||||
:: %vega: kernel reload notification
|
||||
:: %wegh: request for memory usage report
|
||||
::
|
||||
+$ task
|
||||
$% [%hear =lane =blob]
|
||||
[%hole =lane =blob]
|
||||
[%heed =ship]
|
||||
[%jilt =ship]
|
||||
$>(%plea vane-task)
|
||||
::
|
||||
$>(%born vane-task)
|
||||
$>(%crud vane-task)
|
||||
$>(%init vane-task)
|
||||
$>(%vega vane-task)
|
||||
$>(%wegh vane-task)
|
||||
==
|
||||
:: $gift: effect from ames
|
||||
::
|
||||
:: Messaging Gifts
|
||||
::
|
||||
:: %boon: response message from remote ship
|
||||
:: %clog: notify vane that %boon's to peer are backing up locally
|
||||
:: %done: notify vane that peer (n)acked our message
|
||||
:: %lost: notify vane that we crashed on %boon
|
||||
:: %send: packet to unix
|
||||
::
|
||||
:: System and Lifecycle Gifts
|
||||
::
|
||||
:: %mass: memory usage report
|
||||
:: %turf: domain report, relayed from jael
|
||||
::
|
||||
+$ gift
|
||||
$% [%boon payload=*]
|
||||
[%clog =ship]
|
||||
[%done error=(unit error)]
|
||||
[%lost ~]
|
||||
[%send =lane =blob]
|
||||
::
|
||||
[%mass p=mass]
|
||||
[%turf turfs=(list turf)]
|
||||
==
|
||||
-- ::able
|
||||
::
|
||||
:::: :: (1a2)
|
||||
@ -427,131 +461,28 @@
|
||||
++ com |~(a/pass ^?(..nu)) :: from pass
|
||||
-- ::nu ::
|
||||
-- ::acru ::
|
||||
++ bait {p/skin q/@ud r/dove} :: fmt nrecvd spec
|
||||
++ bath :: convo per client
|
||||
$: sop/shed :: not stalled
|
||||
raz/(map path race) :: statements inbound
|
||||
ryl/(map path rill) :: statements outbound
|
||||
== ::
|
||||
++ boon :: fort output
|
||||
$% [%beer p=ship] :: request public keys
|
||||
[%bock ~] :: bind to domains
|
||||
[%brew ~] :: request domains
|
||||
[%cake p=ship q=soap r=coop s=duct] :: e2e message result
|
||||
[%mead p=lane q=rock] :: accept packet
|
||||
[%milk p=ship q=soap r=*] :: e2e pass message
|
||||
[%ouzo p=lane q=rock] :: transmit packet
|
||||
[%pito p=@da] :: timeout
|
||||
[%raki p=ship q=life r=pass] :: neighbor'd
|
||||
[%sake ~] :: our private keys
|
||||
[%wine p=ship q=tape] :: notify user
|
||||
== ::
|
||||
++ cake {p/sock q/skin r/@} :: top level packet
|
||||
++ cape :: end-to-end result
|
||||
$? $good :: delivered
|
||||
$dead :: rejected
|
||||
== ::
|
||||
++ clot :: symmetric record
|
||||
$: yed/(unit {p/hand q/code}) :: outbound
|
||||
heg/(map hand code) :: proposed
|
||||
qim/(map hand code) :: inbound
|
||||
== ::
|
||||
++ code @uvI :: symmetric key
|
||||
++ corn :: flow by server
|
||||
$: nys/(map flap bait) :: packets incoming
|
||||
olz/(map flap cape) :: packets completed
|
||||
wab/(map ship bath) :: relationship
|
||||
== ::
|
||||
+$ deed [=life =pass oath=(unit oath:pki:jael)] :: life/pub/sig
|
||||
++ dore :: foreign contact
|
||||
$: wod/road :: connection to
|
||||
caq/clot :: symmetric key state
|
||||
== ::
|
||||
++ dove {p/@ud q/(map @ud @)} :: count hash 13-blocks
|
||||
++ flap @uvH :: network packet id
|
||||
++ flow :: packet connection
|
||||
$: rtt/@dr :: decaying avg rtt
|
||||
wid/@ud :: logical wdow msgs
|
||||
== ::
|
||||
++ fort :: formal state
|
||||
$: $1 :: version
|
||||
gad/duct :: client interface
|
||||
tim/(unit @da) :: pending timer
|
||||
tuf/(list turf) :: domains
|
||||
hop/@da :: network boot date
|
||||
bad/(set @p) :: bad ships
|
||||
ton/town :: security
|
||||
zac/corn :: flows by server
|
||||
== ::
|
||||
++ hand @uvH :: 128-bit hash
|
||||
++ lane :: packet route
|
||||
$% {$if p/@da q/@ud r/@if} :: IP4/public UDP/addr
|
||||
{$is p/@ud q/(unit lane) r/@is} :: IPv6 w+alternates
|
||||
{$ix p/@da q/@ud r/@if} :: IPv4 provisional
|
||||
== ::
|
||||
++ meal :: payload
|
||||
$% {$back p/coop q/flap r/@dr} :: ack
|
||||
{$bond p/path q/@ud r/*} :: message
|
||||
{$carp p/@ q/@ud r/@ud s/flap t/@} :: skin+inx+cnt+hash
|
||||
{$fore p/ship q/(unit lane) r/@} :: forwarded packet
|
||||
== ::
|
||||
++ name {p/@t q/(unit @t) r/(unit @t) s/@t} :: first mid+nick last
|
||||
++ putt :: outgoing message
|
||||
$: ski/snow :: sequence acked+sent
|
||||
wyv/(list rock) :: packet list XX gear
|
||||
== ::
|
||||
++ race :: inbound stream
|
||||
$: did/@ud :: filled sequence
|
||||
dod/? :: not processing
|
||||
bum/(map @ud ares) :: nacks
|
||||
mis/(map @ud {p/cape q/lane r/flap s/(unit)}) :: misordered
|
||||
== ::
|
||||
++ rill :: outbound stream
|
||||
$: sed/@ud :: sent
|
||||
san/(map @ud duct) :: outstanding
|
||||
== ::
|
||||
++ road :: secured oneway route
|
||||
$: exp/@da :: expiration date
|
||||
lun/(unit lane) :: route to friend
|
||||
lew/(unit deed) :: deed of friend
|
||||
== ::
|
||||
++ rock @uvO :: packet
|
||||
++ shed :: packet flow
|
||||
$: $: rtt/@dr :: smoothed rtt
|
||||
rto/@dr :: retransmit timeout
|
||||
rtn/(unit @da) :: next timeout
|
||||
rue/(unit @da) :: last heard from
|
||||
== ::
|
||||
$: nus/@ud :: number sent
|
||||
nif/@ud :: number live
|
||||
nep/@ud :: next expected
|
||||
caw/@ud :: logical window
|
||||
cag/@ud :: congest thresh
|
||||
== ::
|
||||
$: diq/(map flap @ud) :: packets sent
|
||||
pyz/(map soup @ud) :: message+unacked
|
||||
puq/(qeu {p/@ud q/soul}) :: packet queue
|
||||
== ::
|
||||
== ::
|
||||
++ skin ?($none $open $fast $full) :: encoding stem
|
||||
++ snow {p/@ud q/@ud r/(set @ud)} :: window exceptions
|
||||
++ soap {p/{p/life q/life} q/path r/@ud} :: statement id
|
||||
++ soup {p/path q/@ud} :: new statement id
|
||||
++ soul :: packet in travel
|
||||
$: gom/soup :: message identity
|
||||
nux/@ud :: xmission count
|
||||
liv/? :: deemed live
|
||||
lys/@da :: last sent
|
||||
pac/rock :: packet data
|
||||
== ::
|
||||
++ town :: all security state
|
||||
$: any/@ :: entropy
|
||||
val/wund :: private keys
|
||||
law/deed :: server deed
|
||||
seh/(map hand {p/ship q/@da}) :: key cache
|
||||
hoc/(map ship dore) :: neighborhood
|
||||
== ::
|
||||
++ wund (list {p/life q/ring r/acru}) :: secrets in action
|
||||
:: $address: opaque atomic transport address to or from unix
|
||||
::
|
||||
+$ address @uxaddress
|
||||
:: $blob: raw atom to or from unix, representing a packet
|
||||
::
|
||||
+$ blob @uxblob
|
||||
:: $error: tagged diagnostic trace
|
||||
::
|
||||
+$ error [tag=@tas =tang]
|
||||
:: $lane: ship transport address; either opaque $address or galaxy
|
||||
::
|
||||
:: The runtime knows how to look up galaxies, so we don't need to
|
||||
:: know their transport addresses.
|
||||
::
|
||||
+$ lane (each @pC address)
|
||||
:: $plea: application-level message, as a %pass
|
||||
::
|
||||
:: vane: destination vane on remote ship
|
||||
:: path: internal route on the receiving ship
|
||||
:: payload: semantic message contents
|
||||
::
|
||||
+$ plea [vane=@tas =path payload=*]
|
||||
-- ::ames
|
||||
:: ::::
|
||||
:::: ++behn :: (1b) timekeeping
|
||||
@ -594,18 +525,18 @@
|
||||
++ able ^?
|
||||
|%
|
||||
++ gift :: out result <-$
|
||||
$% {$croz rus/(map desk {r/regs w/regs})} :: rules for group
|
||||
$% [%boon payload=*] :: ames response
|
||||
{$croz rus/(map desk {r/regs w/regs})} :: rules for group
|
||||
{$cruz cez/(map @ta crew)} :: permission groups
|
||||
{$dirk p/@tas} :: mark mount dirty
|
||||
{$ergo p/@tas q/mode} :: version update
|
||||
{$hill p/(list @tas)} :: mount points
|
||||
{$mack p/(unit tang)} :: ack
|
||||
[%done error=(unit error:ames)] :: ames message (n)ack
|
||||
{$mass p/mass} :: memory usage
|
||||
{$mere p/(each (set path) (pair term tang))} :: merge result
|
||||
{$note p/@tD q/tank} :: debug message
|
||||
{$ogre p/@tas} :: delete mount point
|
||||
{$rule red/dict wit/dict} :: node r+w permissions
|
||||
{$send p/lane:ames q/@} :: transmit packet
|
||||
{$writ p/riot} :: response
|
||||
{$wris p/{$da p/@da} q/(set (pair care path))} :: many changes
|
||||
== ::
|
||||
@ -634,7 +565,7 @@
|
||||
{$warp wer/ship rif/riff} :: internal file req
|
||||
{$werp who/ship wer/ship rif/riff} :: external file req
|
||||
$>(%wegh vane-task) :: report memory
|
||||
$>(%west vane-task) :: network request
|
||||
$>(%plea vane-task) :: ames request
|
||||
== ::
|
||||
-- ::able
|
||||
::
|
||||
@ -777,7 +708,6 @@
|
||||
{$logo ~} :: logout
|
||||
{$lyra p/@t q/@t} :: upgrade kernel
|
||||
{$mass p/mass} :: memory usage
|
||||
{$send p/lane:ames q/@} :: transmit packet
|
||||
{$veer p/@ta q/path r/@t} :: install vane
|
||||
{$verb ~} :: verbose mode
|
||||
== ::
|
||||
@ -1873,21 +1803,21 @@
|
||||
++ able ^?
|
||||
|%
|
||||
++ gift :: outgoing result
|
||||
$% {$mass p/mass} :: memory usage
|
||||
$% [%boon payload=*] :: ames response
|
||||
[%done error=(unit error:ames)] :: ames message (n)ack
|
||||
{$mass p/mass} :: memory usage
|
||||
{$onto p/(each suss tang)} :: about agent
|
||||
{$rend p/path q/*} :: network request
|
||||
{$unto p/sign:agent} ::
|
||||
{$mack p/(unit tang)} :: message ack
|
||||
== ::
|
||||
++ task :: incoming request
|
||||
$~ [%vega ~] ::
|
||||
$% {$conf p/dock q/dock} :: configure app
|
||||
$>(%init vane-task) :: set owner
|
||||
{$deal p/sock q/term r/deal} :: full transmission
|
||||
[%goad force=? agent=(unit dude)] :: rebuild agent(s)
|
||||
$>(%init vane-task) :: set owner
|
||||
$>(%trim vane-task) :: trim state
|
||||
$>(%vega vane-task) :: report upgrade
|
||||
$>(%west vane-task) :: network request
|
||||
$>(%plea vane-task) :: network request
|
||||
[%wash ~] :: clear caches
|
||||
$>(%wegh vane-task) :: report memory
|
||||
== ::
|
||||
@ -1924,7 +1854,6 @@
|
||||
==
|
||||
+$ deal
|
||||
$% [%raw-poke =mark =noun]
|
||||
[%pump ~]
|
||||
task:agent
|
||||
==
|
||||
::
|
||||
@ -2137,7 +2066,8 @@
|
||||
++ gift :: out result <-$
|
||||
$% [%init p=ship] :: report install unix
|
||||
[%mass p=mass] :: memory usage report
|
||||
[%mack p=(unit tang)] :: message n/ack
|
||||
[%done error=(unit error:ames)] :: ames message (n)ack
|
||||
[%boon payload=*] :: ames response
|
||||
[%private-keys =life vein=(map life ring)] :: private keys
|
||||
[%public-keys =public-keys-result] :: ethereum changes
|
||||
[%turf turf=(list turf)] :: domains
|
||||
@ -2162,7 +2092,7 @@
|
||||
[%turf ~] :: view domains
|
||||
$>(%vega vane-task) :: report upgrade
|
||||
$>(%wegh vane-task) :: memory usage request
|
||||
$>(%west vane-task) :: remote request
|
||||
$>(%plea vane-task) :: ames request
|
||||
== ::
|
||||
::
|
||||
+$ dawn-event
|
||||
@ -2337,56 +2267,7 @@
|
||||
++ oath @ :: signature
|
||||
-- :: pki
|
||||
-- :: jael
|
||||
:: ::::
|
||||
:::: ++xmas :: (1i) new network
|
||||
:: ::::
|
||||
++ xmas ^?
|
||||
:: ::
|
||||
:::: ++able:xmas :: (1i1) arvo moves
|
||||
:: ::::
|
||||
|%
|
||||
++ able ^?
|
||||
|%
|
||||
++ gift ::
|
||||
$% {$east p/*} :: response message
|
||||
{$home p/lane q/@} :: process forward
|
||||
{$send p/lane q/@} :: send packet
|
||||
{$rest p/coop} :: acknowledgment
|
||||
== ::
|
||||
++ task :: in request ->$
|
||||
$% {$hear p/lane q/@} ::
|
||||
{$mess p/ship q/path r/*} :: send message
|
||||
{$wake ~} ::
|
||||
== ::
|
||||
++ card :: out cards
|
||||
$% {$west p/ship q/path r/*} :: network request
|
||||
== ::
|
||||
++ sign :: in response $-<
|
||||
$: $g ::
|
||||
$% {$rend p/path q/*} :: network request
|
||||
{$mack p/(unit tang)} :: message ack
|
||||
== == ::
|
||||
++ note :: out request $->
|
||||
$% {$c $west p/ship q/path r/*} :: to %clay
|
||||
{$e $west p/ship q/path r/*} :: to %eyre
|
||||
{$g $west p/ship q/path r/*} :: to %gall
|
||||
$: $j :: to %jael
|
||||
$% {$line p/ship q/@da r/code} ::
|
||||
{$link p/ship q/@da r/code} ::
|
||||
{$veil p/ship} ::
|
||||
{$west p/ship q/path r/*} :: to %gall
|
||||
== == == ::
|
||||
-- :: able
|
||||
::
|
||||
:::: :: (1i2)
|
||||
::
|
||||
++ code @uvI :: symmetric key
|
||||
++ lane :: packet route
|
||||
$% {$if p/@da q/@ud r/@if} :: IP4/public UDP/addr
|
||||
{$is p/@ud q/(unit lane) r/@is} :: IPv6 w+alternates
|
||||
{$ix p/@da q/@ud r/@if} :: IPv4 provisional
|
||||
== ::
|
||||
-- ::xmas
|
||||
++ gift-arvo :: out result <-$
|
||||
$~ [%init ~zod]
|
||||
$% gift:able:ames
|
||||
@ -2404,14 +2285,14 @@
|
||||
task:able:clay
|
||||
task:able:behn
|
||||
task:able:dill
|
||||
task:able:iris
|
||||
task:able:eyre
|
||||
task:able:ford
|
||||
task:able:gall
|
||||
task:able:eyre
|
||||
task:able:iris
|
||||
task:able:jael
|
||||
==
|
||||
++ note-arvo :: out request $->
|
||||
$~ [%a %wake ~]
|
||||
$~ [%b %wake ~]
|
||||
$% {$a task:able:ames}
|
||||
{$b task:able:behn}
|
||||
{$c task:able:clay}
|
||||
@ -2439,13 +2320,11 @@
|
||||
[%i gift:able:iris]
|
||||
{$j gift:able:jael}
|
||||
==
|
||||
:: $unix-task: input from unix
|
||||
::
|
||||
+$ unix-task :: input from unix
|
||||
$~ [%wake ~]
|
||||
$% :: %ames: new process
|
||||
::
|
||||
$>(%barn task:able:ames)
|
||||
:: %dill: keyboard input
|
||||
$% :: %dill: keyboard input
|
||||
::
|
||||
$>(%belt task:able:dill)
|
||||
:: %dill: configure terminal (resized)
|
||||
@ -2490,9 +2369,6 @@
|
||||
:: %behn: wakeup
|
||||
::
|
||||
$>(%wake task:able:behn)
|
||||
:: %ames: send message
|
||||
::
|
||||
$>(%want task:able:ames)
|
||||
==
|
||||
-- ::
|
||||
:: :: ::
|
||||
@ -7601,6 +7477,15 @@
|
||||
[%& p=rul]
|
||||
-- ::scanf
|
||||
--
|
||||
:: +harden: coerce %soft $hobo or pass-through
|
||||
::
|
||||
++ harden
|
||||
|* task=mold
|
||||
|= wrapped=(hobo task)
|
||||
^- task
|
||||
?. ?=(%soft -.wrapped)
|
||||
wrapped
|
||||
;;(task +.wrapped)
|
||||
::
|
||||
++ zuse %309 :: hoon+zuse kelvin
|
||||
:: ::
|
||||
|
@ -20,19 +20,37 @@
|
||||
^- (quip card:agent:gall _ships)
|
||||
:_ ships
|
||||
%+ emit-aqua-events our
|
||||
[%event who [//newt/0v1n.2m9vh %barn ~]]~
|
||||
[%event who [//newt/0v1n.2m9vh %born ~]]~
|
||||
::
|
||||
++ handle-send
|
||||
|= [our=ship now=@da way=wire %send lan=lane:ames pac=@]
|
||||
|= [our=ship now=@da way=wire sendr=@p %send lan=lane:ames pac=@]
|
||||
^- (quip card:agent:gall _ships)
|
||||
=/ hear [//newt/0v1n.2m9vh %hear lan pac]
|
||||
=? ships & :: =(~ ships)
|
||||
.^((list ship) %gx /(scot %p our)/aqua/(scot %da now)/ships/noun)
|
||||
=/ rcvr=ship (lane-to-ship lan)
|
||||
=/ hear-lane (ship-to-lane sndr)
|
||||
:_ ships
|
||||
%+ emit-aqua-events our
|
||||
%+ turn ships
|
||||
|= who=ship
|
||||
[%event who hear]
|
||||
[%event rcvr //newt/0v1n.2m9vh %hear hear-lane pac]~
|
||||
:: +lane-to-ship: decode a ship from an aqua lane
|
||||
::
|
||||
++ lane-to-ship
|
||||
|= =lane:ames
|
||||
^- ship
|
||||
::
|
||||
?- -.lane
|
||||
%& p.lane
|
||||
%| `ship``@`p.lane
|
||||
==
|
||||
:: +ship-to-lane: encode a lane to look like it came from .ship
|
||||
::
|
||||
:: Never shows up as a galaxy, because Vere wouldn't know that either.
|
||||
::
|
||||
++ ship-to-lane
|
||||
|= =ship
|
||||
^- lane:ames
|
||||
::
|
||||
[%| `address:ames``@`ship]
|
||||
--
|
||||
::
|
||||
%- aqua-vane-thread
|
||||
@ -44,7 +62,7 @@
|
||||
=^ cards ships
|
||||
?+ -.q.ue `ships
|
||||
%restore (handle-restore our.bowl who)
|
||||
%send (handle-send our.bowl now.bowl ue)
|
||||
%send (handle-send our.bowl now.bowl who ue)
|
||||
==
|
||||
[cards this]
|
||||
::
|
||||
|
@ -5,56 +5,64 @@
|
||||
::
|
||||
=/ vane (alef !>(..zuse))
|
||||
::
|
||||
=/ alice vane
|
||||
=/ bob vane
|
||||
=/ nec vane
|
||||
=/ bud vane
|
||||
::
|
||||
=. our.alice ~nec
|
||||
=. now.alice ~1111.1.1
|
||||
=. eny.alice 0xdead.beef
|
||||
=. our.nec ~nec
|
||||
=. now.nec ~1111.1.1
|
||||
=. eny.nec 0xdead.beef
|
||||
=. scry-gate.nec |=(* ``[%noun !>(*(list turf))])
|
||||
::
|
||||
=. our.bob ~doznec-doznec
|
||||
=. now.bob ~1111.1.1
|
||||
=. eny.bob 0xbeef.dead
|
||||
=. our.bud ~bud
|
||||
=. now.bud ~1111.1.1
|
||||
=. eny.bud 0xbeef.dead
|
||||
=. scry-gate.bud |=(* ``[%noun !>(*(list turf))])
|
||||
::
|
||||
=. crypto-core.ames-state.alice (pit:nu:crub:crypto 512 (shaz 'alice'))
|
||||
=. crypto-core.ames-state.bob (pit:nu:crub:crypto 512 (shaz 'bob'))
|
||||
=. crypto-core.ames-state.nec (pit:nu:crub:crypto 512 (shaz 'nec'))
|
||||
=. crypto-core.ames-state.bud (pit:nu:crub:crypto 512 (shaz 'bud'))
|
||||
::
|
||||
=/ alice-pub pub:ex:crypto-core.ames-state.alice
|
||||
=/ alice-sec sec:ex:crypto-core.ames-state.alice
|
||||
=/ bob-pub pub:ex:crypto-core.ames-state.bob
|
||||
=/ bob-sec sec:ex:crypto-core.ames-state.bob
|
||||
=/ nec-pub pub:ex:crypto-core.ames-state.nec
|
||||
=/ nec-sec sec:ex:crypto-core.ames-state.nec
|
||||
=/ bud-pub pub:ex:crypto-core.ames-state.bud
|
||||
=/ bud-sec sec:ex:crypto-core.ames-state.bud
|
||||
::
|
||||
=/ alice-sym (derive-symmetric-key:alef bob-pub alice-sec)
|
||||
=/ bob-sym (derive-symmetric-key:alef alice-pub bob-sec)
|
||||
=/ nec-sym (derive-symmetric-key:vane bud-pub nec-sec)
|
||||
=/ bud-sym (derive-symmetric-key:vane nec-pub bud-sec)
|
||||
::
|
||||
?> =(alice-sym bob-sym)
|
||||
?> =(nec-sym bud-sym)
|
||||
::
|
||||
=. life.ames-state.alice 2
|
||||
=. peers.ames-state.alice
|
||||
%+ ~(put by peers.ames-state.alice) ~doznec-doznec
|
||||
=. life.ames-state.nec 2
|
||||
=. peers.ames-state.nec
|
||||
%+ ~(put by peers.ames-state.nec) ~bud
|
||||
=| =peer-state:alef
|
||||
=. -.peer-state
|
||||
:* symmetric-key=bob-sym
|
||||
:* symmetric-key=bud-sym
|
||||
life=3
|
||||
public-key=bob-pub
|
||||
sponsor=~marzod
|
||||
public-key=bud-pub
|
||||
sponsor=~nec
|
||||
==
|
||||
=. route.peer-state `[direct=%.y `lane:alef`[%& ~nec]]
|
||||
[%known peer-state]
|
||||
::
|
||||
=. life.ames-state.bob 3
|
||||
=. peers.ames-state.bob
|
||||
%+ ~(put by peers.ames-state.bob) ~nec
|
||||
=. life.ames-state.bud 3
|
||||
=. peers.ames-state.bud
|
||||
%+ ~(put by peers.ames-state.bud) ~nec
|
||||
=| =peer-state:alef
|
||||
=. -.peer-state
|
||||
:* symmetric-key=alice-sym
|
||||
:* symmetric-key=nec-sym
|
||||
life=2
|
||||
public-key=alice-pub
|
||||
public-key=nec-pub
|
||||
sponsor=~nec
|
||||
==
|
||||
=. route.peer-state `[direct=%.y `lane:alef`[%| `@`%lane-bar]]
|
||||
[%known peer-state]
|
||||
:: metamorphose
|
||||
::
|
||||
=> .(nec +:(call:(nec) ~[//unix] ** %born ~))
|
||||
=> .(bud +:(call:(bud) ~[//unix] ** %born ~))
|
||||
:: helper core
|
||||
::
|
||||
=>
|
||||
|%
|
||||
++ move-to-packet
|
||||
|= =move:alef
|
||||
@ -75,19 +83,37 @@
|
||||
%- move-to-packet
|
||||
%+ snag index
|
||||
(skim moves is-move-send)
|
||||
::
|
||||
++ call
|
||||
|= [vane=_nec =duct =task:alef]
|
||||
^- [moves=(list move:alef) _nec]
|
||||
::
|
||||
=/ vane-core (vane(now `@da`(add ~s1 now.vane)))
|
||||
::
|
||||
(call:vane-core duct ** task)
|
||||
::
|
||||
++ take
|
||||
|= [vane=_nec =wire =duct =sign:alef]
|
||||
^- [moves=(list move:alef) _nec]
|
||||
::
|
||||
=/ vane-core (vane(now `@da`(add ~s1 now.vane)))
|
||||
::
|
||||
(take:vane-core wire duct ** sign)
|
||||
--
|
||||
:: test core
|
||||
::
|
||||
|%
|
||||
++ test-packet-encoding ^- tang
|
||||
::
|
||||
=/ =packet:alef
|
||||
:* [sndr=~nec rcvr=~doznec-doznec]
|
||||
:* [sndr=~nec rcvr=~bud]
|
||||
encrypted=%.n
|
||||
origin=~
|
||||
content=[12 13]
|
||||
==
|
||||
::
|
||||
=/ encoded (encode-packet:alef packet)
|
||||
=/ decoded (decode-packet:alef encoded)
|
||||
=/ encoded (encode-packet:vane packet)
|
||||
=/ decoded (decode-packet:vane encoded)
|
||||
::
|
||||
%+ expect-eq
|
||||
!> packet
|
||||
@ -97,104 +123,108 @@
|
||||
::
|
||||
=/ lane-foo=lane:alef [%| `@ux``@`%lane-foo]
|
||||
::
|
||||
=/ =message:alef [/g/talk [%first %post]]
|
||||
=/ =plea:ames [%g /talk [%first %post]]
|
||||
::
|
||||
=/ =shut-packet:alef
|
||||
:* sndr-life=4
|
||||
rcvr-life=3
|
||||
bone=1
|
||||
message-num=1
|
||||
[%& num-fragments=1 fragment-num=0 (jam message)]
|
||||
[%& num-fragments=1 fragment-num=0 (jam plea)]
|
||||
==
|
||||
::
|
||||
=/ =packet:alef
|
||||
:* [sndr=~bus rcvr=~doznec-doznec]
|
||||
:* [sndr=~bus rcvr=~bud]
|
||||
encrypted=%.y
|
||||
origin=~
|
||||
content=(encrypt:alef alice-sym shut-packet)
|
||||
content=(encrypt:vane nec-sym shut-packet)
|
||||
==
|
||||
::
|
||||
=/ =blob:alef (encode-packet:alef packet)
|
||||
=^ moves1 bob (call bob ~[//unix] %hear lane-foo blob)
|
||||
=^ moves2 bob
|
||||
=/ =blob:alef (encode-packet:vane packet)
|
||||
=^ moves1 bud (call bud ~[//unix] %hear lane-foo blob)
|
||||
=^ moves2 bud
|
||||
=/ =point:alef
|
||||
:* rift=1
|
||||
life=4
|
||||
crypto-suite=1
|
||||
encryption-key=`@`alice-pub
|
||||
authentication-key=`@`0
|
||||
keys=[[life=4 [crypto-suite=1 `@`nec-pub]] ~ ~]
|
||||
sponsor=`~bus
|
||||
==
|
||||
%- take
|
||||
:^ bob /alien ~[//unix]
|
||||
:^ bud /public-keys ~[//unix]
|
||||
^- sign:alef
|
||||
[%j %public-keys %full [n=[~bus point] ~ ~]]
|
||||
[%k %public-keys %full [n=[~bus point] ~ ~]]
|
||||
::
|
||||
;: weld
|
||||
%+ expect-eq
|
||||
!> [~[//unix] %pass /alien %j %public-keys ~bus]~
|
||||
!> [~[//unix] %pass /public-keys %k %public-keys [~bus ~ ~]]~
|
||||
!> moves1
|
||||
::
|
||||
%+ expect-eq
|
||||
!> [~[//unix] %pass /bone/~bus/1 %g %memo ~bus /g/talk [%first %post]]~
|
||||
!> moves2
|
||||
!> %- sy
|
||||
:~ :^ ~[//unix] %pass /bone/~bus/1
|
||||
[%g %plea ~bus %g /talk [%first %post]]
|
||||
::
|
||||
:^ ~[//unix] %pass /qos
|
||||
[%d %flog %text "; ~bus is your neighbor"]
|
||||
==
|
||||
!> (sy ,.moves2)
|
||||
==
|
||||
::
|
||||
++ test-message-flow ^- tang
|
||||
:: ~nec -> %plea -> ~bud
|
||||
::
|
||||
=^ moves1 alice
|
||||
(call alice ~[/alice] %memo ~doznec-doznec /g/talk [%get %post])
|
||||
=^ moves1 nec (call nec ~[/g/talk] %plea ~bud %g /talk [%get %post])
|
||||
=^ moves2 bud (call bud ~[//unix] %hear (snag-packet 0 moves1))
|
||||
:: ~bud -> %done -> ~nec
|
||||
::
|
||||
=^ moves2 bob (call bob ~[/bob] %hear (snag-packet 0 moves1))
|
||||
=^ moves3 bob (take bob /bone/~nec/1 ~[/bob] %g %done ~)
|
||||
=^ moves4 alice (call alice ~[/alice] %hear (snag-packet 0 moves3))
|
||||
=^ moves5 bob
|
||||
(take bob /bone/~nec/1 ~[/bob] %g %memo /g/talk [%post 'first1!!'])
|
||||
=^ moves3 bud (take bud /bone/~nec/1 ~[//unix] %g %done ~)
|
||||
=^ moves4 nec (call nec ~[//unix] %hear (snag-packet 0 moves3))
|
||||
:: ~bud -> %boon -> ~nec
|
||||
::
|
||||
=^ moves6 alice (call alice ~[/alice] %hear (snag-packet 0 moves5))
|
||||
=^ moves7 bob (call bob ~[/bob] %hear (snag-packet 0 moves6))
|
||||
=^ moves5 bud (take bud /bone/~nec/1 ~[//unix] %g %boon [%post 'first1!!'])
|
||||
=^ moves6 nec (call nec ~[//unix] %hear (snag-packet 0 moves5))
|
||||
:: ~nec -> %done -> ~bud (just make sure ~bud doesn't crash on ack)
|
||||
::
|
||||
=^ moves7 bud (call bud ~[//unix] %hear (snag-packet 0 moves6))
|
||||
::
|
||||
;: weld
|
||||
%+ expect-eq
|
||||
!> :~ :+ ~[/alice] %give [%done error=~]
|
||||
:+ ~[/alice] %pass
|
||||
[/pump/~doznec-doznec/0 %b %rest ~1111.1.1..00.00.06]
|
||||
!> :~ [~[//unix] %pass /qos %d %flog %text "; ~nec is your neighbor"]
|
||||
[~[//unix] %pass /bone/~nec/1 %g %plea ~nec %g /talk [%get %post]]
|
||||
==
|
||||
!> moves4
|
||||
!> moves2
|
||||
::
|
||||
%+ expect-eq
|
||||
!> [~[/alice] %give %memo /g/talk %post 'first1!!']
|
||||
!> %- sy
|
||||
:~ [~[//unix] %pass /qos %d %flog %text "; ~bud is your neighbor"]
|
||||
[~[//unix] %pass /pump/~bud/0 %b %rest ~1111.1.1..00.00.06]
|
||||
[~[/g/talk] %give %done error=~]
|
||||
==
|
||||
!> (sy ,.moves4)
|
||||
::
|
||||
%+ expect-eq
|
||||
!> [~[/g/talk] %give %boon [%post 'first1!!']]
|
||||
!> (snag 1 `(list move:alef)`moves6)
|
||||
==
|
||||
::
|
||||
++ test-nack ^- tang
|
||||
=^ moves1 alice
|
||||
(call alice ~[/alice] %memo ~doznec-doznec /g/talk [%get %post])
|
||||
:: ~nec -> %plea -> ~bud
|
||||
::
|
||||
=^ moves1 nec (call nec ~[/g/talk] %plea ~bud %g /talk [%get %post])
|
||||
=^ moves2 bud (call bud ~[//unix] %hear (snag-packet 0 moves1))
|
||||
:: ~bud -> nack -> ~nec
|
||||
::
|
||||
=^ moves2 bob (call bob ~[/bob] %hear (snag-packet 0 moves1))
|
||||
=/ =error:alef [%flub [%leaf "sinusoidal repleneration"]~]
|
||||
=^ moves3 bob (take bob /bone/~nec/1 ~[/bob] %g %done `error)
|
||||
=^ moves4 alice (call alice ~[/alice] %hear (snag-packet 0 moves3))
|
||||
=^ moves5 alice (call alice ~[/alice] %hear (snag-packet 1 moves3))
|
||||
=^ moves6 bob (call bob ~[/bob] %hear (snag-packet 0 moves5))
|
||||
=^ moves3 bud (take bud /bone/~nec/1 ~[/bud] %g %done `error)
|
||||
=^ moves4 nec (call nec ~[//unix] %hear (snag-packet 0 moves3))
|
||||
:: ~bud -> nack-trace -> ~nec
|
||||
::
|
||||
=^ moves5 nec (call nec ~[//unix] %hear (snag-packet 1 moves3))
|
||||
:: ~nec -> ack nack-trace -> ~bud
|
||||
::
|
||||
=^ moves6 bud (call bud ~[//unix] %hear (snag-packet 0 moves5))
|
||||
::
|
||||
%+ expect-eq
|
||||
!> [~[/alice] %give %done `error]
|
||||
!> [~[/g/talk] %give %done `error]
|
||||
!> (snag 1 `(list move:alef)`moves5)
|
||||
::
|
||||
++ call
|
||||
|= [vane=_alice =duct =task:alef]
|
||||
^- [moves=(list move:alef) _alice]
|
||||
::
|
||||
=/ vane-core (vane(now `@da`(add ~s1 now.vane)))
|
||||
::
|
||||
(call:vane-core duct ** task)
|
||||
::
|
||||
++ take
|
||||
|= [vane=_alice =wire =duct =sign:alef]
|
||||
^- [moves=(list move:alef) _alice]
|
||||
::
|
||||
=/ vane-core (vane(now `@da`(add ~s1 now.vane)))
|
||||
::
|
||||
(take:vane-core wire duct ** sign)
|
||||
--
|
||||
|
@ -1,176 +0,0 @@
|
||||
/+ *test
|
||||
::
|
||||
/= ames-raw /: /===/sys/vane/ames
|
||||
/!noun/
|
||||
=/ type-spear -:!>(ames-raw)
|
||||
::
|
||||
=/ test-pit=vase !>(.)
|
||||
=/ ames-gate (ames-raw test-pit)
|
||||
::
|
||||
|%
|
||||
:: tests that %ames asks for private keys on %init
|
||||
::
|
||||
++ test-init
|
||||
=^ results1 ames-gate
|
||||
=/ =duct [/ /term/1 / ~]
|
||||
=/ =wire /our/~nul
|
||||
%: ames-call
|
||||
ames-gate
|
||||
now=~1234.5.6
|
||||
call-args=[duct type=*type %soft %init ~nul]
|
||||
expected-moves=[[duct %pass wire %j %private-keys ~] [duct %pass / %j %turf ~] ~]
|
||||
==
|
||||
::
|
||||
results1
|
||||
:: XX disabled for now as test depends on %ames protocol version
|
||||
::
|
||||
:: tests that %ames sends a message to itself
|
||||
::
|
||||
:: ++ test-send
|
||||
:: =/ now ~1234.5.6
|
||||
:: =/ =duct [/ /term/1 / ~]
|
||||
:: =/ =wire /our/~nul
|
||||
:: =/ pact1
|
||||
:: 0wHfb.1hdCh.0oxed.Ta7-f.4IIDV.4ku6J.PoJe7.AiyMS.w~mfu.V04ja.iXj8d.E3nq7.
|
||||
:: gcW-a.0II6T.vb5zH.FHEkp.J7wgT.XTnuu.KaUiu.xZ6dg.qgWSH.3ovaO.dETNQ.5YAOR.
|
||||
:: Lw8Mj.iQCrM.-TcjY.gFysP.XCfdx.52ack.MN~yA.0CNFU.0eL1M.Un-ey.CZyf9.Omk2p.
|
||||
:: -Wbar.-w2bs.02sNg.340cg.okHUP
|
||||
:: =/ pact2
|
||||
:: 0w78EWp.7898D.odZ3b.7iLvr.vyjzn.XBNaN.vxTZj.b4BFp.EHHvW.IjvpB.j0~87.
|
||||
:: t06D0.SbrGK.QlIeE.1Xj1v.CX~YY.c9cAE.eUPSb.gj8-M.e15TJ.EPPXN.efms-.8y9og.
|
||||
:: IdyLr.lkZJ5.KMB-F.S7mwd.t5rmo.CEYCp.3zC4n.HYh2T.RgVI8.0eT1z.Jxj9c.m1Sm5.
|
||||
:: SaYrP.0LKO3.-w2cA.02sNg.340cg.oi9Nj
|
||||
:: =/ vein-data
|
||||
:: [life=1 (my [1 sec:ex:(pit:nu:crub:crypto 512 ~nul)] ~)]
|
||||
:: ::
|
||||
:: =^ results1 ames-gate
|
||||
:: %: ames-call
|
||||
:: ames-gate
|
||||
:: now
|
||||
:: call-args=[duct type=*type %soft [%barn ~]]
|
||||
:: expected-moves=[[duct %give %turf ~] ~]
|
||||
:: ==
|
||||
:: ::
|
||||
:: =. now (add ~m1 now)
|
||||
:: :: ~& [%fox1 now fox.ames-gate]
|
||||
:: =^ results2 ames-gate
|
||||
:: %: ames-take
|
||||
:: ames-gate
|
||||
:: now
|
||||
:: take-args=[wire duct -:!>([%j %private-keys vein-data]) [%j %private-keys vein-data]]
|
||||
:: expected-moves=~
|
||||
:: ==
|
||||
:: ::
|
||||
:: =. now (add ~m1 now)
|
||||
:: :: ~& [%fox2 now fox.ames-gate]
|
||||
:: =^ results3 ames-gate
|
||||
:: %: ames-call
|
||||
:: ames-gate
|
||||
:: now
|
||||
:: call-args=[duct type=*type %soft [%want ~nul /foo 1]]
|
||||
:: :~ [duct %pass /pubs/~nul %j %public-keys (silt ~nul ~)]
|
||||
:: [duct %give %send *lane:ames pact1]
|
||||
:: :: XX why ~s4 ??
|
||||
:: ::
|
||||
:: [duct %pass /ames %b %wait (add ~s4 now)]
|
||||
:: ==
|
||||
:: ==
|
||||
:: ::
|
||||
:: =. now (add ~m1 now)
|
||||
:: :: ~& [%fox3 now fox.ames-gate]
|
||||
:: =^ results4 ames-gate
|
||||
:: %: ames-call
|
||||
:: ames-gate
|
||||
:: now
|
||||
:: call-args=[duct type=*type %soft [%want ~nul /foo 2]]
|
||||
:: expected-moves=[[duct %give %send *lane:ames pact2] ~]
|
||||
:: ==
|
||||
:: ::
|
||||
:: =. now (add ~m1 now)
|
||||
:: :: ~& [%fox4 now fox.ames-gate]
|
||||
:: =^ results5 ames-gate
|
||||
:: %: ames-take
|
||||
:: ames-gate
|
||||
:: now
|
||||
:: take-args=[wire duct -:!>([%b %wake ~]) [%b %wake ~]]
|
||||
:: :~ [duct %give %send *lane:ames pact1]
|
||||
:: [duct %give %send *lane:ames pact2]
|
||||
:: [duct %pass /ames %b %wait (add ~s8 now)]
|
||||
:: ==
|
||||
:: ==
|
||||
:: ::
|
||||
:: :: ~& [%fox5 now fox.ames-gate]
|
||||
:: :(weld results1 results2 results3 results4 results5)
|
||||
::
|
||||
++ ames-scry
|
||||
^- sley
|
||||
|= [* (unit (set monk)) =term =beam]
|
||||
^- (unit (unit cage))
|
||||
?: =(%turf q.beam)
|
||||
(some (some %noun !>(~)))
|
||||
::
|
||||
?: ?& =(%life q.beam)
|
||||
=(/~nul s.beam)
|
||||
==
|
||||
(some (some %atom !>(1)))
|
||||
::
|
||||
?: ?& =(%saxo q.beam)
|
||||
=(/~nul s.beam)
|
||||
==
|
||||
(some (some %noun !>([~nul ~])))
|
||||
::
|
||||
?: ?& =(%sein q.beam)
|
||||
=(/~nul s.beam)
|
||||
==
|
||||
(some (some %atom !>(~nul)))
|
||||
::
|
||||
?: ?& =(%deed q.beam)
|
||||
=(/1/~nul s.beam)
|
||||
==
|
||||
=/ =deed:ames
|
||||
[life=1 pub:ex:(pit:nu:crub:crypto 512 ~nul) ~]
|
||||
(some (some %noun !>(deed)))
|
||||
::
|
||||
~& [%ames-scry-fail +<]
|
||||
~
|
||||
::
|
||||
++ ames-call
|
||||
|= $: ames-gate=_ames-gate
|
||||
now=@da
|
||||
call-args=[=duct wrapped-task=(hypo (hobo task:able:ames-gate))]
|
||||
expected-moves=(list move:ames-gate)
|
||||
==
|
||||
^- [tang _ames-gate]
|
||||
::
|
||||
=/ ames (ames-gate our=~nul now=now eny=`@`0xdead.beef ames-scry)
|
||||
::
|
||||
=^ moves ames-gate
|
||||
(call:ames call-args)
|
||||
::
|
||||
=/ output=tang
|
||||
%+ expect-eq
|
||||
!> expected-moves
|
||||
!> moves
|
||||
::
|
||||
[output ames-gate]
|
||||
::
|
||||
++ ames-take
|
||||
|= $: ames-gate=_ames-gate
|
||||
now=@da
|
||||
take-args=[=wire =duct wrapped-sign=(hypo sign:ames-gate)]
|
||||
expected-moves=(list move:ames-gate)
|
||||
==
|
||||
^- [tang _ames-gate]
|
||||
::
|
||||
=/ ames (ames-gate our=~nul now=now eny=`@`0xdead.beef ames-scry)
|
||||
::
|
||||
=^ moves ames-gate
|
||||
(take:ames take-args)
|
||||
::
|
||||
=/ output=tang
|
||||
%+ expect-eq
|
||||
!> expected-moves
|
||||
!> moves
|
||||
::
|
||||
[output ames-gate]
|
||||
--
|
@ -15,7 +15,7 @@ worker_objs = $(shell echo $(worker) | sed 's/\.c/.o/g')
|
||||
|
||||
all_objs = $(common_objs) $(daemon_objs) $(worker_objs)
|
||||
all_srcs = $(common) $(daemon) $(worker)
|
||||
all_exes = ./build/mug_tests ./build/jam_tests \
|
||||
all_exes = ./build/ames_tests ./build/mug_tests ./build/jam_tests \
|
||||
./build/noun_tests ./build/hashtable_tests \
|
||||
./build/urbit ./build/urbit-worker
|
||||
|
||||
@ -31,7 +31,8 @@ CFLAGS := $(CFLAGS)
|
||||
|
||||
all: $(all_exes)
|
||||
|
||||
test: build/hashtable_tests build/jam_tests build/mug_tests build/noun_tests
|
||||
test: build/ames_tests build/hashtable_tests build/jam_tests build/mug_tests build/noun_tests
|
||||
./build/ames_tests
|
||||
./build/hashtable_tests
|
||||
./build/jam_tests
|
||||
./build/mug_tests
|
||||
@ -45,6 +46,23 @@ mrproper: clean
|
||||
|
||||
################################################################################
|
||||
|
||||
include/ca-bundle.h:
|
||||
@echo XXD -i $(SSL_CERT_FILE)
|
||||
@cat $(SSL_CERT_FILE) > include/ca-bundle.crt
|
||||
@xxd -i include/ca-bundle.crt > include/ca-bundle.h
|
||||
@rm include/ca-bundle.crt
|
||||
|
||||
include/ivory.h:
|
||||
@echo XXD -i $(IVORY)
|
||||
@cat $(IVORY) > u3_Ivory.pill
|
||||
@xxd -i u3_Ivory.pill > include/ivory.h
|
||||
@rm u3_Ivory.pill
|
||||
|
||||
build/ames_tests: $(common_objs) tests/ames_tests.o
|
||||
@echo CC -o $@
|
||||
@mkdir -p ./build
|
||||
@$(CC) $^ $(LDFLAGS) -o $@
|
||||
|
||||
build/hashtable_tests: $(common_objs) tests/hashtable_tests.o
|
||||
@echo CC -o $@
|
||||
@mkdir -p ./build
|
||||
|
BIN
pkg/urbit/hashtable_tests
Executable file
BIN
pkg/urbit/hashtable_tests
Executable file
Binary file not shown.
@ -248,6 +248,13 @@
|
||||
c3_c* dns_c; // galaxy fqdn (optional)
|
||||
} u3_pact;
|
||||
|
||||
/* u3_lane: ames lane (IP address and port)
|
||||
*/
|
||||
typedef struct _u3_lane {
|
||||
c3_w pip_w; // target IPv4 address
|
||||
c3_s por_s; // target port
|
||||
} u3_lane;
|
||||
|
||||
/* u3_poke: poke callback function.
|
||||
*/
|
||||
typedef void (*u3_poke)(void*, u3_noun);
|
||||
@ -330,7 +337,6 @@
|
||||
uv_udp_t wax_u;
|
||||
uv_handle_t had_u;
|
||||
};
|
||||
uv_timer_t tim_u; // XX temporary timer
|
||||
c3_o liv; // listener on
|
||||
c3_o alm; // alarm on
|
||||
c3_s por_s; // public IPv4 port
|
||||
@ -979,6 +985,15 @@
|
||||
void
|
||||
u3_ames_io_exit(u3_pier* pir_u);
|
||||
|
||||
/* u3_ames_decode_lane(): destructure lane from noun
|
||||
*/
|
||||
u3_lane
|
||||
u3_ames_decode_lane(u3_noun);
|
||||
|
||||
/* u3_ames_encode_lane(): encode lane as noun
|
||||
*/
|
||||
u3_noun
|
||||
u3_ames_encode_lane(u3_lane);
|
||||
|
||||
/** Autosave.
|
||||
**/
|
||||
|
44
pkg/urbit/tests/ames_tests.c
Normal file
44
pkg/urbit/tests/ames_tests.c
Normal file
@ -0,0 +1,44 @@
|
||||
#include "all.h"
|
||||
#include "vere/vere.h"
|
||||
|
||||
/* _setup(): prepare for tests.
|
||||
*/
|
||||
static void
|
||||
_setup(void)
|
||||
{
|
||||
u3m_init();
|
||||
u3m_pave(c3y, c3n);
|
||||
}
|
||||
|
||||
/* _test_ames(): spot check ames helpers
|
||||
*/
|
||||
static void
|
||||
_test_ames(void)
|
||||
{
|
||||
u3_lane lan_u;
|
||||
lan_u.pip_w = 0x7f000001;
|
||||
lan_u.por_s = 12345;
|
||||
|
||||
u3_noun lan = u3_ames_encode_lane(lan_u);
|
||||
u3_lane nal_u = u3_ames_decode_lane(u3k(lan));
|
||||
u3_lane nal_u2 = u3_ames_decode_lane(lan);
|
||||
|
||||
if ( !(lan_u.pip_w == nal_u.pip_w && lan_u.por_s == nal_u.por_s) ) {
|
||||
fprintf(stderr, "ames: lane fail (a)\r\n");
|
||||
fprintf(stderr, "pip: %d, por: %d\r\n", nal_u.pip_w, nal_u.por_s);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
/* main(): run all test cases.
|
||||
*/
|
||||
int
|
||||
main(int argc, char* argv[])
|
||||
{
|
||||
_setup();
|
||||
|
||||
_test_ames();
|
||||
|
||||
fprintf(stderr, "ames okeedokee");
|
||||
return 0;
|
||||
}
|
BIN
pkg/urbit/urbit
Executable file
BIN
pkg/urbit/urbit
Executable file
Binary file not shown.
BIN
pkg/urbit/urbit-worker
Executable file
BIN
pkg/urbit/urbit-worker
Executable file
Binary file not shown.
@ -88,7 +88,6 @@ _ames_send(u3_pact* pac_u)
|
||||
add_u.sin_port = htons(pac_u->por_s);
|
||||
|
||||
uv_buf_t buf_u = uv_buf_init((c3_c*)pac_u->hun_y, pac_u->len_w);
|
||||
|
||||
c3_i sas_i;
|
||||
|
||||
if ( 0 != (sas_i = uv_udp_send(&pac_u->snd_u,
|
||||
@ -194,6 +193,33 @@ _ames_czar_cb(uv_getaddrinfo_t* adr_u,
|
||||
uv_freeaddrinfo(aif_u);
|
||||
}
|
||||
|
||||
/* u3_ames_decode_lane(): deserialize noun to lane
|
||||
*/
|
||||
u3_lane
|
||||
u3_ames_decode_lane(u3_atom lan) {
|
||||
u3_noun cud, tag, pip, por;
|
||||
|
||||
cud = u3ke_cue(lan);
|
||||
u3x_trel(cud, &tag, &pip, &por);
|
||||
c3_assert( c3__ipv4 == tag );
|
||||
|
||||
u3_lane lan_u;
|
||||
lan_u.pip_w = u3r_word(0, pip);
|
||||
|
||||
c3_assert( _(u3a_is_cat(por)) );
|
||||
c3_assert( por < 65536 );
|
||||
lan_u.por_s = por;
|
||||
|
||||
u3z(cud);
|
||||
return lan_u;
|
||||
}
|
||||
|
||||
/* u3_ames_encode_lane(): serialize lane to jammed noun
|
||||
*/
|
||||
u3_atom
|
||||
u3_ames_encode_lane(u3_lane lan) {
|
||||
return u3ke_jam(u3nt(c3__ipv4, u3i_words(1, &lan.pip_w), lan.por_s));
|
||||
}
|
||||
|
||||
/* _ames_czar(): galaxy address resolution.
|
||||
*/
|
||||
@ -268,34 +294,6 @@ _ames_czar(u3_pact* pac_u, c3_c* bos_c)
|
||||
}
|
||||
}
|
||||
|
||||
/* _ames_lane_ipv4(): IPv4 address/ from lane.
|
||||
*/
|
||||
u3_noun
|
||||
_ames_lane_ip(u3_noun lan, c3_s* por_s, c3_w* pip_w)
|
||||
{
|
||||
switch ( u3h(lan) ) {
|
||||
case c3__if: {
|
||||
*por_s= (c3_s) u3h(u3t(u3t(lan)));
|
||||
*pip_w = u3r_word(0, u3t(u3t(u3t(lan))));
|
||||
|
||||
return c3y;
|
||||
} break;
|
||||
case c3__is: {
|
||||
u3_noun pq_lan = u3h(u3t(u3t(lan)));
|
||||
|
||||
if ( u3_nul == pq_lan ) return c3n;
|
||||
else return _ames_lane_ip(u3t(pq_lan), por_s, pip_w);
|
||||
} break;
|
||||
case c3__ix: {
|
||||
*por_s = (c3_s) u3h(u3t(u3t(lan)));
|
||||
*pip_w = u3r_word(0, u3t(u3t(u3t(lan))));
|
||||
|
||||
return c3y;
|
||||
} break;
|
||||
}
|
||||
return c3n;
|
||||
}
|
||||
|
||||
/* u3_ames_ef_bake(): notify %ames that we're live.
|
||||
*/
|
||||
void
|
||||
@ -303,7 +301,7 @@ u3_ames_ef_bake(u3_pier* pir_u)
|
||||
{
|
||||
u3_noun pax = u3nq(u3_blip, c3__newt, u3k(u3A->sen), u3_nul);
|
||||
|
||||
u3_pier_plan(pax, u3nc(c3__barn, u3_nul));
|
||||
u3_pier_plan(pax, u3nc(c3__born, u3_nul));
|
||||
}
|
||||
|
||||
/* u3_ames_ef_send(): send packet to network (v4).
|
||||
@ -320,35 +318,45 @@ u3_ames_ef_send(u3_pier* pir_u, u3_noun lan, u3_noun pac)
|
||||
}
|
||||
|
||||
u3_pact* pac_u = c3_calloc(sizeof(*pac_u));
|
||||
|
||||
if ( c3y == _ames_lane_ip(lan, &pac_u->por_s, &pac_u->pip_w) ) {
|
||||
pac_u->len_w = u3r_met(3, pac);
|
||||
pac_u->hun_y = c3_malloc(pac_u->len_w);
|
||||
|
||||
u3r_bytes(0, pac_u->len_w, pac_u->hun_y, pac);
|
||||
|
||||
if ( 0 == pac_u->pip_w ) {
|
||||
pac_u->pip_w = 0x7f000001;
|
||||
pac_u->por_s = pir_u->por_s;
|
||||
}
|
||||
u3_noun tag, val;
|
||||
u3x_cell(lan, &tag, &val);
|
||||
c3_assert( (c3y == tag) || (c3n == tag) );
|
||||
|
||||
if ( (0 == (pac_u->pip_w >> 16)) && (1 == (pac_u->pip_w >> 8)) ) {
|
||||
pac_u->imp_y = (pac_u->pip_w & 0xff);
|
||||
// galaxy lane; do DNS lookup and send packet
|
||||
//
|
||||
if ( c3y == tag ) {
|
||||
c3_assert( c3y == u3a_is_cat(val) );
|
||||
c3_assert( val < 256 );
|
||||
|
||||
pac_u->imp_y = val;
|
||||
_ames_czar(pac_u, sam_u->dns_c);
|
||||
}
|
||||
else if ( (c3y == u3_Host.ops_u.net) || (0x7f000001 == pac_u->pip_w) ) {
|
||||
// non-galaxy lane
|
||||
//
|
||||
else {
|
||||
u3_lane lan_u = u3_ames_decode_lane(u3k(val));
|
||||
// convert incoming localhost to outgoing localhost
|
||||
//
|
||||
lan_u.pip_w = ( 0 == lan_u.pip_w )? 0x7f000001 : lan_u.pip_w;
|
||||
// if in local-only mode, don't send remote packets
|
||||
//
|
||||
if ( (c3n == u3_Host.ops_u.net) && (0x7f000001 != lan_u.pip_w) ) {
|
||||
_ames_pact_free(pac_u);
|
||||
}
|
||||
// otherwise, mutate destination and send packet
|
||||
//
|
||||
else {
|
||||
pac_u->pip_w = lan_u.pip_w;
|
||||
pac_u->por_s = lan_u.por_s;
|
||||
|
||||
_ames_send(pac_u);
|
||||
}
|
||||
else {
|
||||
// networking disabled
|
||||
_ames_pact_free(pac_u);
|
||||
}
|
||||
}
|
||||
else {
|
||||
_ames_pact_free(pac_u);
|
||||
}
|
||||
|
||||
u3z(lan); u3z(pac);
|
||||
}
|
||||
|
||||
@ -374,30 +382,21 @@ _ames_recv_cb(uv_udp_t* wax_u,
|
||||
#if 0
|
||||
u3z(msg);
|
||||
#else
|
||||
u3_lane lan_u;
|
||||
struct sockaddr_in* add_u = (struct sockaddr_in *)adr_u;
|
||||
c3_s por_s = ntohs(add_u->sin_port);
|
||||
c3_w pip_w = ntohl(add_u->sin_addr.s_addr);
|
||||
|
||||
u3_pier_plan
|
||||
(u3nt(u3_blip, c3__ames, u3_nul),
|
||||
u3nt(c3__hear,
|
||||
u3nq(c3__if, u3k(u3A->now), por_s, u3i_words(1, &pip_w)),
|
||||
msg));
|
||||
lan_u.por_s = ntohs(add_u->sin_port);
|
||||
lan_u.pip_w = ntohl(add_u->sin_addr.s_addr);
|
||||
u3_noun lan = u3_ames_encode_lane(lan_u);
|
||||
u3_noun mov = u3nt(c3__hear, u3nc(c3n, lan), msg);
|
||||
|
||||
u3_pier_plan(u3nt(u3_blip, c3__ames, u3_nul), mov);
|
||||
#endif
|
||||
}
|
||||
_ames_free(buf_u->base);
|
||||
}
|
||||
}
|
||||
|
||||
/* _ames_timer_cb(): wake up ames
|
||||
*/
|
||||
static void
|
||||
_ames_timer_cb(uv_timer_t* tim_u)
|
||||
{
|
||||
u3_pier_plan(u3nt(u3_blip, c3__ames, u3_nul),
|
||||
u3nc(c3__wake, u3_nul));
|
||||
}
|
||||
|
||||
/* _ames_io_start(): initialize ames I/O.
|
||||
*/
|
||||
static void
|
||||
@ -467,8 +466,6 @@ _ames_io_start(u3_pier* pir_u)
|
||||
sam_u->liv = c3y;
|
||||
u3z(rac);
|
||||
u3z(who);
|
||||
|
||||
uv_timer_start(&sam_u->tim_u, _ames_timer_cb, 300 * 1000, 300 * 1000);
|
||||
}
|
||||
|
||||
/* _cttp_mcut_char(): measure/cut character.
|
||||
@ -561,8 +558,6 @@ u3_ames_io_init(u3_pier* pir_u)
|
||||
{
|
||||
u3_ames* sam_u = pir_u->sam_u;
|
||||
sam_u->liv = c3n;
|
||||
|
||||
uv_timer_init(u3L, &sam_u->tim_u);
|
||||
}
|
||||
|
||||
/* u3_ames_io_talk(): start receiving ames traffic.
|
||||
@ -570,6 +565,7 @@ u3_ames_io_init(u3_pier* pir_u)
|
||||
void
|
||||
u3_ames_io_talk(u3_pier* pir_u)
|
||||
{
|
||||
_ames_io_start(pir_u);
|
||||
}
|
||||
|
||||
/* u3_ames_io_exit(): terminate ames I/O.
|
||||
@ -583,6 +579,4 @@ u3_ames_io_exit(u3_pier* pir_u)
|
||||
// XX remove had_u/wax_u union, cast and close wax_u
|
||||
uv_close(&sam_u->had_u, 0);
|
||||
}
|
||||
|
||||
uv_close((uv_handle_t*)&sam_u->tim_u, 0);
|
||||
}
|
||||
|
@ -373,6 +373,21 @@ _worker_send_slog(u3_noun hod)
|
||||
_worker_send(u3nt(c3__slog, u3i_chubs(1, &u3V.sen_d), hod));
|
||||
}
|
||||
|
||||
/* _worker_send_tang(): send list of hoon tanks as hint outputs.
|
||||
*/
|
||||
static void
|
||||
_worker_send_tang(c3_y pri_y, u3_noun tan)
|
||||
{
|
||||
u3_noun i_tan, t_tan;
|
||||
while ( u3_nul != tan ) {
|
||||
i_tan = u3k(u3h(tan));
|
||||
t_tan = u3k(u3t(tan));
|
||||
u3z(tan);
|
||||
_worker_send_slog(u3nc(pri_y, i_tan));
|
||||
tan = t_tan;
|
||||
}
|
||||
}
|
||||
|
||||
/* _worker_lame(): event failed, replace with error event.
|
||||
*/
|
||||
static void
|
||||
@ -392,6 +407,7 @@ _worker_lame(c3_d evt_d, u3_noun now, u3_noun ovo, u3_noun why, u3_noun tan)
|
||||
// with a crypto failure, just drop the packet.
|
||||
//
|
||||
if ( (c3__hear == tag) && (c3__exit == why) ) {
|
||||
_worker_send_tang(1, u3k(tan));
|
||||
rep = u3nt(u3k(wir), c3__hole, u3k(cad));
|
||||
}
|
||||
// failed event notifications (%crud) are replaced with
|
||||
@ -403,6 +419,7 @@ _worker_lame(c3_d evt_d, u3_noun now, u3_noun ovo, u3_noun why, u3_noun tan)
|
||||
else if ( c3__crud == tag ) {
|
||||
u3_noun lef = u3nc(c3__leaf, u3i_tape("crude crashed!"));
|
||||
u3_noun nat = u3kb_weld(u3k(u3t(cad)), u3nc(lef, u3k(tan)));
|
||||
_worker_send_tang(1, u3k(nat));
|
||||
rep = u3nc(u3nt(u3_blip, c3__arvo, u3_nul),
|
||||
u3nt(c3__warn, u3k(u3h(cad)), nat));
|
||||
}
|
||||
@ -422,6 +439,7 @@ _worker_lame(c3_d evt_d, u3_noun now, u3_noun ovo, u3_noun why, u3_noun tan)
|
||||
u3_noun lef = u3nc(c3__leaf, u3kb_weld(u3i_tape("bail: "),
|
||||
u3qc_rip(3, why)));
|
||||
u3_noun nat = u3kb_weld(u3k(tan), u3nc(lef, u3_nul));
|
||||
_worker_send_tang(1, u3k(nat));
|
||||
rep = u3nc(u3k(wir), u3nt(c3__crud, u3k(tag), nat));
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user