BIN
.dat/content.bitfield
Normal file
BIN
.dat/content.bitfield
Normal file
Binary file not shown.
BIN
.dat/content.key
Normal file
BIN
.dat/content.key
Normal file
Binary file not shown.
BIN
.dat/content.signatures
Normal file
BIN
.dat/content.signatures
Normal file
Binary file not shown.
BIN
.dat/content.tree
Normal file
BIN
.dat/content.tree
Normal file
Binary file not shown.
BIN
.dat/metadata.bitfield
Normal file
BIN
.dat/metadata.bitfield
Normal file
Binary file not shown.
BIN
.dat/metadata.data
Normal file
BIN
.dat/metadata.data
Normal file
Binary file not shown.
1
.dat/metadata.key
Normal file
1
.dat/metadata.key
Normal file
@@ -0,0 +1 @@
|
|||||||
|
Yь ⌠≥Q#ёф⌠ШX┤╥╩║XoAВОXrb*з│
|
||||||
BIN
.dat/metadata.ogd
Normal file
BIN
.dat/metadata.ogd
Normal file
Binary file not shown.
BIN
.dat/metadata.signatures
Normal file
BIN
.dat/metadata.signatures
Normal file
Binary file not shown.
BIN
.dat/metadata.tree
Normal file
BIN
.dat/metadata.tree
Normal file
Binary file not shown.
5
LICENSE
Normal file
5
LICENSE
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
Creative Communism ☭
|
||||||
|
This is My Software
|
||||||
|
Freedom is a spook
|
||||||
|
|
||||||
|
NO WARRANTY, NOT MEANT TO DIAGNOSE OR CURE ANY ILLNESS
|
||||||
4
README.txt
Normal file
4
README.txt
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
back up dat thang
|
||||||
|
breaking out of JS jail and enabling both c and scheme env
|
||||||
|
dis dat://59d8099399510e23a3c693fb5887b7bba1586f4117f7ef1c5872622ada0c1181
|
||||||
|
you might discuss here cabal://cf2caf3a1c4fd299471d315416b6cc3d9c5f7c678046652fb70ede4ff16698db
|
||||||
5
dat.json
Normal file
5
dat.json
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"title": "dat-thang",
|
||||||
|
"description": "dat:// implemented over c & scheme",
|
||||||
|
"url": "dat://59d8099399510e23a3c693fb5887b7bba1586f4117f7ef1c5872622ada0c1181"
|
||||||
|
}
|
||||||
3
dat.scm
Normal file
3
dat.scm
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
((title . "dat-thang")
|
||||||
|
(description . "dat:// implemented over c & scheme")
|
||||||
|
(url . "dat://59d8099399510e23a3c693fb5887b7bba1586f4117f7ef1c5872622ada0c1181"))
|
||||||
BIN
docs/dat-paper.pdf
Normal file
BIN
docs/dat-paper.pdf
Normal file
Binary file not shown.
34
docs/dat.1
Normal file
34
docs/dat.1
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
.Dd 2025-09-25
|
||||||
|
.Dt DATT 1
|
||||||
|
.Os WORLIO
|
||||||
|
.ds REPO dat://59d8099399510e23a3c693fb5887b7bba1586f4117f7ef1c5872622ada0c1181
|
||||||
|
.Sh NAME
|
||||||
|
.Nm dat-thang
|
||||||
|
.Nd call a dat method
|
||||||
|
.Sh SYNOPSIS
|
||||||
|
.Nm
|
||||||
|
.Op Fl d Ar debug
|
||||||
|
.
|
||||||
|
.Oo
|
||||||
|
.Op Fl t Ar type
|
||||||
|
.Ar method
|
||||||
|
.Op Ar argument ...
|
||||||
|
.Oc
|
||||||
|
.Sh DESCRIPTION
|
||||||
|
wip
|
||||||
|
.Sh OPTIONS
|
||||||
|
.It Fl d
|
||||||
|
Debug
|
||||||
|
.Sh FILES
|
||||||
|
.Bl -tag -width -indent
|
||||||
|
.It Pa ~/.dat/secret_keys/
|
||||||
|
its there
|
||||||
|
.Sh AUTHORS
|
||||||
|
"Dat" was first written about by Mathias Buus Madsen & Maxwell Ogden (c) 2015
|
||||||
|
.Nm
|
||||||
|
was written by
|
||||||
|
.An divorce Aq @4c3NtV5p+7MRCwinLcD+dVMgz2rGbX2wF/ZtDxBA/Lw=.ed25519
|
||||||
|
.Sh BUGS
|
||||||
|
.Pp
|
||||||
|
Go ahead an fix em ;)
|
||||||
|
.Lk \*[REPO]
|
||||||
BIN
docs/sleep.pdf
Normal file
BIN
docs/sleep.pdf
Normal file
Binary file not shown.
29
extra/parse.js
Normal file
29
extra/parse.js
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
const isNode = typeof window === 'undefined'
|
||||||
|
const parse = isNode ? require('url').parse : browserParse
|
||||||
|
|
||||||
|
const SCHEME_REGEX = /[a-z]+:\/\//i
|
||||||
|
// 1 2 3 4
|
||||||
|
const VERSION_REGEX = /^(dat:\/\/)?([^/]+)(\+[^/]+)(.*)$/i
|
||||||
|
|
||||||
|
module.exports = function parseDatURL (str, parseQS) {
|
||||||
|
// prepend the scheme if it's missing
|
||||||
|
if (!SCHEME_REGEX.test(str)) {
|
||||||
|
str = 'dat://' + str
|
||||||
|
}
|
||||||
|
|
||||||
|
var parsed, version = null, match = VERSION_REGEX.exec(str)
|
||||||
|
if (match) {
|
||||||
|
// run typical parse with version segment removed
|
||||||
|
parsed = parse((match[1] || '') + (match[2] || '') + (match[4] || ''), parseQS)
|
||||||
|
version = match[3].slice(1)
|
||||||
|
} else {
|
||||||
|
parsed = parse(str, parseQS)
|
||||||
|
}
|
||||||
|
if (isNode) parsed.href = str // overwrite href to include actual original
|
||||||
|
parsed.version = version // add version segment
|
||||||
|
return parsed
|
||||||
|
}
|
||||||
|
|
||||||
|
function browserParse (str) {
|
||||||
|
return new URL(str)
|
||||||
|
}
|
||||||
82
extra/schema.proto
Normal file
82
extra/schema.proto
Normal file
@@ -0,0 +1,82 @@
|
|||||||
|
// wire format is <len>(<header><message>)
|
||||||
|
// header is a varint, channel << 4 | <4-bit-type>
|
||||||
|
|
||||||
|
// type=0, should be the first message sent on a channel
|
||||||
|
message Feed {
|
||||||
|
required bytes discoveryKey = 1;
|
||||||
|
optional bytes nonce = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
// type=1, overall connection handshake. should be send just after the feed message on the first channel only
|
||||||
|
message Handshake {
|
||||||
|
optional bytes id = 1;
|
||||||
|
optional bool live = 2; // keep the connection open forever? both ends have to agree
|
||||||
|
optional bytes userData = 3;
|
||||||
|
repeated string extensions = 4;
|
||||||
|
optional bool ack = 5; // Should all blocks be explicitly acknowledged?
|
||||||
|
}
|
||||||
|
|
||||||
|
// type=2, message indicating state changes etc.
|
||||||
|
// initial state for uploading/downloading is true
|
||||||
|
// if both ends are not downloading and not live it is safe to consider the stream ended
|
||||||
|
message Info {
|
||||||
|
optional bool uploading = 1;
|
||||||
|
optional bool downloading = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
// type=3, what do we have?
|
||||||
|
message Have {
|
||||||
|
required uint64 start = 1;
|
||||||
|
optional uint64 length = 2 [default = 1]; // defaults to 1
|
||||||
|
optional bytes bitfield = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
// type=4, what did we lose?
|
||||||
|
message Unhave {
|
||||||
|
required uint64 start = 1;
|
||||||
|
optional uint64 length = 2 [default = 1]; // defaults to 1
|
||||||
|
}
|
||||||
|
|
||||||
|
// type=5, what do we want? remote should start sending have messages in this range
|
||||||
|
message Want {
|
||||||
|
required uint64 start = 1;
|
||||||
|
optional uint64 length = 2; // defaults to Infinity or feed.length (if not live)
|
||||||
|
}
|
||||||
|
|
||||||
|
// type=6, what don't we want anymore?
|
||||||
|
message Unwant {
|
||||||
|
required uint64 start = 1;
|
||||||
|
optional uint64 length = 2; // defaults to Infinity or feed.length (if not live)
|
||||||
|
}
|
||||||
|
|
||||||
|
// type=7, ask for data
|
||||||
|
message Request {
|
||||||
|
required uint64 index = 1;
|
||||||
|
optional uint64 bytes = 2;
|
||||||
|
optional bool hash = 3;
|
||||||
|
optional uint64 nodes = 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
// type=8, cancel a request
|
||||||
|
message Cancel {
|
||||||
|
required uint64 index = 1;
|
||||||
|
optional uint64 bytes = 2;
|
||||||
|
optional bool hash = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
// type=9, get some data
|
||||||
|
message Data {
|
||||||
|
message Node {
|
||||||
|
required uint64 index = 1;
|
||||||
|
required bytes hash = 2;
|
||||||
|
required uint64 size = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
required uint64 index = 1;
|
||||||
|
optional bytes value = 2;
|
||||||
|
repeated Node nodes = 3;
|
||||||
|
optional bytes signature = 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
// type=15 (last message) is an extension message
|
||||||
|
// that is encoded like this <varint user-type><payload>
|
||||||
0
inc/cesspool.h
Normal file
0
inc/cesspool.h
Normal file
0
inc/keys.h
Normal file
0
inc/keys.h
Normal file
40
src/varint.scm
Normal file
40
src/varint.scm
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
;; VarInt encoding and decoding utilities
|
||||||
|
;; These functions implement variable-length integer encoding commonly used in Protocol Buffers
|
||||||
|
|
||||||
|
;; Encode a positive integer into a varint format
|
||||||
|
(define (encode-varint n)
|
||||||
|
(cond ((< n 128)
|
||||||
|
;; Single byte case
|
||||||
|
(list n))
|
||||||
|
(else
|
||||||
|
;; Recursive case: encode remaining bits and prepend current byte
|
||||||
|
(append (encode-varint (arithmetic-shift n -7))
|
||||||
|
(list (bitwise-or (logand n 127) 128))))))
|
||||||
|
|
||||||
|
;; Decode a varint from a sequence of bytes
|
||||||
|
(define (decode-varint bytes)
|
||||||
|
(define (decode-helper bytes result shift)
|
||||||
|
(if (null? bytes)
|
||||||
|
(error "Incomplete varint"))
|
||||||
|
(let ((byte (car bytes)))
|
||||||
|
(cond ((zero? (bitwise-and byte 128))
|
||||||
|
;; Last byte encountered
|
||||||
|
(+ result (arithmetic-shift byte shift)))
|
||||||
|
(else
|
||||||
|
;; Continue decoding with next byte
|
||||||
|
(decode-helper (cdr bytes)
|
||||||
|
(+ result (arithmetic-shift (logand byte 127) shift))
|
||||||
|
(+ shift 7)))))))
|
||||||
|
(decode-helper bytes 0))
|
||||||
|
|
||||||
|
;; Helper functions for working with varints
|
||||||
|
(define (varint-bytes->list bytes)
|
||||||
|
(map (lambda (byte) (if (integer? byte) byte (char->integer byte))) bytes))
|
||||||
|
|
||||||
|
(define (varint-list->bytes encoded)
|
||||||
|
(map char encoded))
|
||||||
|
;; Example usage
|
||||||
|
(let ((encoded (encode-varint 16384)))
|
||||||
|
(display "Encoded varint: ") (write encoded) (newline)
|
||||||
|
(let ((decoded (decode-varint encoded)))
|
||||||
|
(display "Decoded value: ") (display decoded) (newline)))
|
||||||
Reference in New Issue
Block a user