Update syndicate-protocols
This commit is contained in:
parent
a2849b18c9
commit
aadf7a3dc7
|
@ -6,6 +6,7 @@ modules += http.nim
|
|||
modules += noise.nim
|
||||
modules += protocol.nim
|
||||
modules += service.nim
|
||||
modules += stdenv.nim
|
||||
modules += stream.nim
|
||||
modules += sturdy.nim
|
||||
modules += tcp.nim
|
||||
|
|
|
@ -8,18 +8,18 @@ type
|
|||
`detail`*: Value
|
||||
|
||||
Turn* = seq[TurnEvent]
|
||||
Message* {.preservesRecord: "message".} = object
|
||||
Message* {.preservesRecord: "M".} = object
|
||||
`body`*: Assertion
|
||||
|
||||
Retract* {.preservesRecord: "retract".} = object
|
||||
Retract* {.preservesRecord: "R".} = object
|
||||
`handle`*: Handle
|
||||
|
||||
Assert* {.preservesRecord: "assert".} = object
|
||||
Assert* {.preservesRecord: "A".} = object
|
||||
`assertion`*: Assertion
|
||||
`handle`*: Handle
|
||||
|
||||
Extension* = Value
|
||||
Sync* {.preservesRecord: "sync".} = object
|
||||
Sync* {.preservesRecord: "S".} = object
|
||||
`peer`* {.preservesEmbedded.}: Value
|
||||
|
||||
TurnEvent* {.preservesTuple.} = object
|
||||
|
|
|
@ -0,0 +1,40 @@
|
|||
|
||||
import
|
||||
preserves, sturdy, gatekeeper
|
||||
|
||||
type
|
||||
StandardTransportKind* {.pure.} = enum
|
||||
`wsUrl`, `other`
|
||||
`StandardTransport`* {.preservesOr.} = object
|
||||
case orKind*: StandardTransportKind
|
||||
of StandardTransportKind.`wsUrl`:
|
||||
`wsurl`*: string
|
||||
|
||||
of StandardTransportKind.`other`:
|
||||
`other`*: Value
|
||||
|
||||
|
||||
StandardRouteKind* {.pure.} = enum
|
||||
`standard`, `general`
|
||||
StandardRouteStandard* {.preservesTuple.} = object
|
||||
`transports`*: seq[StandardTransport]
|
||||
`key`*: seq[byte]
|
||||
`service`*: Value
|
||||
`sig`*: seq[byte]
|
||||
`oid`*: Value
|
||||
`caveats`* {.preservesTupleTail.}: seq[sturdy.Caveat]
|
||||
|
||||
`StandardRoute`* {.preservesOr.} = object
|
||||
case orKind*: StandardRouteKind
|
||||
of StandardRouteKind.`standard`:
|
||||
`standard`*: StandardRouteStandard
|
||||
|
||||
of StandardRouteKind.`general`:
|
||||
`general`*: gatekeeper.Route
|
||||
|
||||
|
||||
proc `$`*(x: StandardTransport | StandardRoute): string =
|
||||
`$`(toPreserves(x))
|
||||
|
||||
proc encode*(x: StandardTransport | StandardRoute): seq[byte] =
|
||||
encode(toPreserves(x))
|
Loading…
Reference in New Issue