Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Make new stuff configurable |
---|---|
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
c4a078389f90a9f2876267f4c5ab24c3 |
User & Date: | bernd 2015-07-09 13:05:40.901 |
Context
2015-08-10
| ||
23:27 | New address code, configurable, not yet active check-in: f0dac0fd91 user: bernd tags: trunk | |
2015-07-09
| ||
13:11 | Create new branch named "new-address" Closed-Leaf check-in: e66fea83d4 user: bernd tags: new-address | |
13:05 | Make new stuff configurable check-in: c4a078389f user: bernd tags: trunk | |
12:53 | Try debug punching with new address format check-in: 4bbbbee38c user: bernd tags: trunk | |
Changes
Changes to debugging.fs.
︙ | ︙ | |||
65 66 67 68 69 70 71 72 73 74 75 76 77 78 | debug: invalid( \ print invalid packets debug: regen( \ regenerate keys debug: sema( \ semaphores debug: recvfrom( debug: sendto( debug: avalanche( \ distribution tree debug: adjust-timer( \ adjust timer -db profile( \ ) 0 [IF] false warnings !@ : c-section ( xt addr -- ) | > | 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 | debug: invalid( \ print invalid packets debug: regen( \ regenerate keys debug: sema( \ semaphores debug: recvfrom( debug: sendto( debug: avalanche( \ distribution tree debug: adjust-timer( \ adjust timer debug: new-addr( \ new address to try out -db profile( \ ) 0 [IF] false warnings !@ : c-section ( xt addr -- ) |
︙ | ︙ |
Changes to net2o-connect.fs.
︙ | ︙ | |||
112 113 114 115 116 117 118 | return-addr return-address $10 move resend0 $off THEN ; : cookie, ( -- ) add-cookie lit, set-cookie ; : request, ( -- ) next-request ulit, request-done ; : gen-punch ( -- ) | | > | 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 | return-addr return-address $10 move resend0 $off THEN ; : cookie, ( -- ) add-cookie lit, set-cookie ; : request, ( -- ) next-request ulit, request-done ; : gen-punch ( -- ) new-addr( my-addr$ [: -sig $, punch ;] )else( my-ip$ [: $, punch ;] ) $[]map ; : cookie+request ( -- ) request( ." gen cookie" forth:cr ) nest[ cookie, request, ]nest ; : gen-punchload ( -- ) request( ." gen punchload" forth:cr ) nest[ cookie, punch-done request, ]nest$ punch-load, ; |
︙ | ︙ |
Changes to net2o-connected.fs.
︙ | ︙ | |||
26 27 28 29 30 31 32 | $20 net2o: disconnect ( -- ) \g close connection o 0= ?EXIT wait-task @ IF <event o elit, ->disconnect wait-task @ event> ELSE n2o:dispose-context THEN un-cmd ; +net2o: set-ip ( $:string -- ) \g set address information $> setip-xt perform ; +net2o: get-ip ( -- ) \g request address information | > | | 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | $20 net2o: disconnect ( -- ) \g close connection o 0= ?EXIT wait-task @ IF <event o elit, ->disconnect wait-task @ event> ELSE n2o:dispose-context THEN un-cmd ; +net2o: set-ip ( $:string -- ) \g set address information $> setip-xt perform ; +net2o: get-ip ( -- ) \g request address information new-addr( new>sockaddr )else( >sockaddr ) $, set-ip [: $, set-ip ;] new-addr( new-n2oaddrs )else( n2oaddrs ) ; +net2o: set-blocksize ( n -- ) \g set blocksize to 2^n 64>n 1 swap max-block# umin lshift blocksizes! ; +net2o: set-blockalign ( n -- ) \g set block alignment to 2^n 64>n 1 swap max-block# umin lshift blockalign ! ; +net2o: close-all ( -- ) \g close all files n2o:close-all ; |
︙ | ︙ |
Changes to net2o-dht.fs.
︙ | ︙ | |||
148 149 150 151 152 153 154 | [: 2dup d#public d# dup @ 0= IF dht-class new >o o swap ! dht-hash $! dht-table @ token-table ! o o> ELSE @ nip nip THEN ;] dht-sema c-section ; : .tag ( addr u -- ) 2dup 2>r >tag verify-tag >r sigpksize# - type r> 2r> .sigdates .check ; : .host ( addr u -- ) over c@ '!' = IF .revoke EXIT THEN | > | | 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 | [: 2dup d#public d# dup @ 0= IF dht-class new >o o swap ! dht-hash $! dht-table @ token-table ! o o> ELSE @ nip nip THEN ;] dht-sema c-section ; : .tag ( addr u -- ) 2dup 2>r >tag verify-tag >r sigpksize# - type r> 2r> .sigdates .check ; : .host ( addr u -- ) over c@ '!' = IF .revoke EXIT THEN 2dup sigsize# - new-addr( .addr$ )else( .ipaddr ) 2dup .sigdates >host verify-host .check 2drop ; : host>$ ( addr u -- addr u' flag ) >host verify-host >r sigsize# - r> ; : d#. ( -- ) dht-hash $@ 85type ." :" cr k#size cell DO I cell/ 0 .r ." : " dht-hash I + I k#host cells = IF |
︙ | ︙ | |||
329 330 331 332 333 334 335 | expect-reply pkc keysize 2* $, dht-id THEN addr o>addr gen-host $, dht-host+ addr >o n2o:dispose-addr o> ['] new-addme-end IS expect-reply? ; previous | | | 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 | expect-reply pkc keysize 2* $, dht-id THEN addr o>addr gen-host $, dht-host+ addr >o n2o:dispose-addr o> ['] new-addme-end IS expect-reply? ; previous : +addme new-addr( ['] new-addme )else( ['] addme ) setip-xt ! ; : -setip ['] .iperr setip-xt ! ; \ replace me stuff also net2o-base : replace-me, ( -- ) pkc keysize 2* $, dht-id dht-host? endwith ; |
︙ | ︙ |
Changes to net2o.fs.
︙ | ︙ | |||
359 360 361 362 363 364 365 | '2' of .ip64 endof dup emit -rot dump endcase ; Defer .addr$ : .iperr ( addr len -- ) [: info-color attr! .time ." connected from: " | | | 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 | '2' of .ip64 endof dup emit -rot dump endcase ; Defer .addr$ : .iperr ( addr len -- ) [: info-color attr! .time ." connected from: " new-addr( .addr$ )else( .ipaddr ) default-color attr! cr ;] $err ; : ipv4! ( ipv4 sockaddr -- ) >r r@ sin6_addr 12 + be-l! $FFFF r@ sin6_addr 8 + be-l! 0 r@ sin6_addr 4 + l! 0 r> sin6_addr l! ; |
︙ | ︙ | |||
1877 1878 1879 1880 1881 1882 1883 | nat( ." send punch to: " return-addr $10 xtype cr ) punch-load $@ punch-reply ; : net2o:punch ( addr u -- ) o IF new-addr punch-load @ IF ['] send-punch ELSE ['] ping-addr1 THEN | | | 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 | nat( ." send punch to: " return-addr $10 xtype cr ) punch-load $@ punch-reply ; : net2o:punch ( addr u -- ) o IF new-addr punch-load @ IF ['] send-punch ELSE ['] ping-addr1 THEN new-addr( addr>sock )else( $>sock ) ELSE 2drop THEN ; \ send chunk \ branchless version using floating point : send-size ( u -- n ) |
︙ | ︙ | |||
2680 2681 2682 2683 2684 2685 2686 | 2dup pk:addme-fetch-host BEGIN >d#id >o 0 dht-host $[]@ o> 2dup d0= !!host-notfound!! over c@ '!' = WHILE replace-key o> >o ke-pk $@ ." replace key: " 2dup 85type cr o o> >r 2dup c:fetch-id r> >o REPEAT 2drop disconnect-me ; : insert-host ( o addr u -- o ) | | | 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 | 2dup pk:addme-fetch-host BEGIN >d#id >o 0 dht-host $[]@ o> 2dup d0= !!host-notfound!! over c@ '!' = WHILE replace-key o> >o ke-pk $@ ." replace key: " 2dup 85type cr o o> >r 2dup c:fetch-id r> >o REPEAT 2drop disconnect-me ; : insert-host ( o addr u -- o ) 2 pick >o \ ." check host: " 2dup .host cr host>$ o> IF [: check-addr1 0= IF 2drop EXIT THEN insert-address temp-addr ins-dest ." insert host: " temp-addr $10 xtype cr return-addr $10 0 skip nip 0= IF temp-addr return-addr $10 move THEN ;] $>sock |
︙ | ︙ | |||
2705 2706 2707 2708 2709 2710 2711 | r> >o n2o:dispose-addr o> ELSE 2drop THEN ; : n2o:pklookup ( addr u -- ) 2dup >d#id { id } id .dht-host $[]# 0= IF 2dup pk-lookup 2dup >d#id to id THEN 0 n2o:new-context >o rdrop 2dup dest-pk return-addr $10 erase | | > | 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 | r> >o n2o:dispose-addr o> ELSE 2drop THEN ; : n2o:pklookup ( addr u -- ) 2dup >d#id { id } id .dht-host $[]# 0= IF 2dup pk-lookup 2dup >d#id to id THEN 0 n2o:new-context >o rdrop 2dup dest-pk return-addr $10 erase id dup .dht-host new-addr( ['] new-insert-host )else( insert-host ) $[]map drop 2drop ; : search-connect ( key u -- o/0 ) 0 [: drop 2dup pubkey $@ str= o and dup 0= ;] search-context nip nip dup to connection ; :noname ( addr u cmdlen datalen -- ) 2>r n2o:pklookup 2r> |
︙ | ︙ |