Skip to content

Commit

Permalink
doc: schema for connect.
Browse files Browse the repository at this point in the history
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
  • Loading branch information
rustyrussell committed May 2, 2021
1 parent 618e805 commit f70d8ad
Show file tree
Hide file tree
Showing 3 changed files with 123 additions and 11 deletions.
45 changes: 39 additions & 6 deletions doc/lightning-connect.7

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 16 additions & 5 deletions doc/lightning-connect.7.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,21 @@ lightning-fundchannel(7).
RETURN VALUE
------------

On success the peer *id* is returned, as well as a hexidecimal
*features* bitmap, a *direction* ("in" if they connected to us, "out"
if we connected to them") and an *address* object as per
lightning-listnodes(7). Note that *address* will be less useful if
"direction" is "in", especially if a proxy is in use.
[comment]: # (GENERATE-FROM-SCHEMA-START)
On success, an object is returned, containing:
- **id** (pubkey): the peer we connected to
- **features** (hex): BOLT 9 features bitmap offered by peer
- **direction** (string): Whether they initiated connection or we did (one of *in*, *out*)
- **address** (object): Address information (mainly useful if **direction** is *out*):
- **type** (string): Type of connection (*torv2*/*torv3* only if **direction** is *out*) (one of *local socket*, *ipv4*, *ipv6*, *torv2*, *torv3*)

If **type** is *local socket*:
- **socket** (string): socket filename

If **type** is *ipv4*, *ipv6*, *torv2* or *torv3*:
- **address** (string): address in expected format for **type**
- **port** (u16): port number
[comment]: # (GENERATE-FROM-SCHEMA-END)

ERRORS
------
Expand Down Expand Up @@ -78,3 +88,4 @@ RESOURCES

Main web site: <https://github.com/ElementsProject/lightning>

[comment]: # ( SHA256STAMP:bb07acd8aa16708c8d5a4e867c104034f13e4dfe79d574a5f82a394497021c79)
68 changes: 68 additions & 0 deletions doc/schemas/connect.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"additionalProperties": false,
"required": [ "id", "features", "direction", "address" ],
"properties": {
"id": {
"type": "pubkey",
"description": "the peer we connected to"
},
"features": {
"type": "hex",
"description": "BOLT 9 features bitmap offered by peer"
},
"direction": {
"type": "string",
"enum": [ "in", "out" ],
"description": "Whether they initiated connection or we did"
},
"address": {
"type": "object",
"description": "Address information (mainly useful if **direction** is *out*)",
"additionalProperties": true,
"required": [ "type" ],
"properties": {
"type": {
"type": "string",
"enum": [ "local socket", "ipv4", "ipv6", "torv2", "torv3" ],
"description": "Type of connection (*torv2*/*torv3* only if **direction** is *out*)"
}
},
"oneOf": [
{
"additionalProperties": false,
"required": [ "socket" ],
"properties": {
"type": {
"type": "string",
"enum": [ "local socket" ]
},
"socket": {
"type": "string",
"description": "socket filename"
}
}
},
{
"additionalProperties": false,
"required": [ "address", "port" ],
"properties": {
"type": {
"type": "string",
"enum": [ "ipv4", "ipv6", "torv2", "torv3" ]
},
"address": {
"type": "string",
"description": "address in expected format for **type**"
},
"port": {
"type": "u16",
"description": "port number"
}
}
}
]
}
}
}

0 comments on commit f70d8ad

Please sign in to comment.