core-lightning/doc/schemas/connect.schema.json
Rusty Russell 4b46190cc4 doc/schemas: schema for connect.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2021-05-27 20:28:49 +09:30

83 lines
1.8 KiB
JSON

{
"$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*)"
}
},
"allOf": [
{
"if": {
"properties": {
"type": {
"type": "string",
"enum": [ "local socket" ]
}
}
},
"then": {
"additionalProperties": false,
"required": [ "socket" ],
"properties": {
"type": { },
"socket": {
"type": "string",
"description": "socket filename"
}
}
}
},
{
"if": {
"properties": {
"type": {
"type": "string",
"enum": [ "ipv4", "ipv6", "torv2", "torv3" ]
}
}
},
"then": {
"additionalProperties": false,
"required": [ "address", "port" ],
"properties": {
"type": { },
"address": {
"type": "string",
"description": "address in expected format for **type**"
},
"port": {
"type": "u16",
"description": "port number"
}
}
}
}
]
}
}
}