libknot 3.3.14.dev0__tar.gz → 3.3.15.dev0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {libknot-3.3.14.dev0 → libknot-3.3.15.dev0}/PKG-INFO +83 -59
- {libknot-3.3.14.dev0 → libknot-3.3.15.dev0}/README.md +82 -58
- {libknot-3.3.14.dev0 → libknot-3.3.15.dev0}/libknot.egg-info/PKG-INFO +83 -59
- {libknot-3.3.14.dev0 → libknot-3.3.15.dev0}/pyproject.toml +1 -1
- {libknot-3.3.14.dev0 → libknot-3.3.15.dev0}/setup.py +1 -1
- {libknot-3.3.14.dev0 → libknot-3.3.15.dev0}/libknot/__init__.py +0 -0
- {libknot-3.3.14.dev0 → libknot-3.3.15.dev0}/libknot/control.py +0 -0
- {libknot-3.3.14.dev0 → libknot-3.3.15.dev0}/libknot/dname.py +0 -0
- {libknot-3.3.14.dev0 → libknot-3.3.15.dev0}/libknot/probe.py +0 -0
- {libknot-3.3.14.dev0 → libknot-3.3.15.dev0}/libknot.egg-info/SOURCES.txt +0 -0
- {libknot-3.3.14.dev0 → libknot-3.3.15.dev0}/libknot.egg-info/dependency_links.txt +0 -0
- {libknot-3.3.14.dev0 → libknot-3.3.15.dev0}/libknot.egg-info/top_level.txt +0 -0
- {libknot-3.3.14.dev0 → libknot-3.3.15.dev0}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: libknot
|
|
3
|
-
Version: 3.3.
|
|
3
|
+
Version: 3.3.15.dev0
|
|
4
4
|
Summary: Python bindings for libknot
|
|
5
5
|
Home-page: https://gitlab.nic.cz/knot/knot-dns/-/tree/master/python/libknot
|
|
6
6
|
Author: CZ.NIC, z.s.p.o.
|
|
@@ -28,9 +28,9 @@ A Python interface for managing the Knot DNS daemon.
|
|
|
28
28
|
|
|
29
29
|
* [Introduction](#introduction)
|
|
30
30
|
* [Control module](#control-module)
|
|
31
|
-
+ [Usage](#control-usage)
|
|
32
31
|
+ [Protocol reference](#kctl-proto)
|
|
33
32
|
+ [Commands reference](#kctl-cmds)
|
|
33
|
+
+ [Usage](#control-usage)
|
|
34
34
|
+ [Examples](#control-examples)
|
|
35
35
|
* [Probe module](#probe-module)
|
|
36
36
|
+ [Probe usage](#probe-usage)
|
|
@@ -58,25 +58,15 @@ i.e. communication via a Unix socket.
|
|
|
58
58
|
|
|
59
59
|
The module API is stored in `libknot.control`.
|
|
60
60
|
|
|
61
|
-
### Control usage<a id="control-usage"></a>
|
|
62
|
-
|
|
63
|
-
The module usage consists of several steps:
|
|
64
|
-
|
|
65
|
-
* Initialization and connection to the daemon control socket.
|
|
66
|
-
* One or more control operations. An operation is called by sending a command
|
|
67
|
-
with optional data to the daemon. The operation result has to be received
|
|
68
|
-
afterwards.
|
|
69
|
-
* Closing the connection and deinitialization.
|
|
70
|
-
|
|
71
61
|
### Protocol overview<a id="kctl-proto"></a>
|
|
72
62
|
|
|
73
63
|
Connections are supposed to be short-lived, because maintaining a passive
|
|
74
|
-
connection is costly for the server. Therefore the expected usage of the
|
|
64
|
+
connection is costly for the server. Therefore the expected usage of the CTL
|
|
75
65
|
interface is to always open a new connection on demand, then close it once it's
|
|
76
66
|
not immediately needed.
|
|
77
67
|
|
|
78
|
-
Messages are composed of units. These are of four types
|
|
79
|
-
defined in `libknot.control.KnotCtlType`:
|
|
68
|
+
Messages are composed of units. These are of four types the identifiers of
|
|
69
|
+
which are defined in `libknot.control.KnotCtlType`:
|
|
80
70
|
|
|
81
71
|
| Type | Description | IO action |
|
|
82
72
|
| ------- | ---------------------------------------------------------- | --------- |
|
|
@@ -85,6 +75,9 @@ defined in `libknot.control.KnotCtlType`:
|
|
|
85
75
|
| `EXTRA` | Additional data. | cache |
|
|
86
76
|
| `BLOCK` | End of data block. | flush |
|
|
87
77
|
|
|
78
|
+
`DATA` and `EXTRA` units aren't immediately sent, rather they're buffered and
|
|
79
|
+
then sent along with the next `END` or `BLOCK` unit.
|
|
80
|
+
|
|
88
81
|
A unit can optionaly hold data, though this is only meaningful for the `DATA`
|
|
89
82
|
and `EXTRA` types. The data consists of several sections of which usually only
|
|
90
83
|
a few at a time will be present. For example when a unit issuing a `stats`
|
|
@@ -92,20 +85,20 @@ command is sent, there is no reason for it to contain an `ERROR` section.
|
|
|
92
85
|
|
|
93
86
|
The data section identifiers are defined in `libknot.control.KnotCtlDataIdx`:
|
|
94
87
|
|
|
95
|
-
| Section name | Description |
|
|
96
|
-
| ------------ | ------------------------------------------------------ |
|
|
97
|
-
| `COMMAND` | Command name. |
|
|
98
|
-
| `FLAGS` | Command flags. |
|
|
99
|
-
| `ERROR` | Error message.
|
|
100
|
-
| `SECTION` | Configuration section name. |
|
|
101
|
-
| `ITEM` | Configuration item name. |
|
|
102
|
-
| `ID` | Configuration item identifier. |
|
|
103
|
-
| `ZONE` | Zone name. |
|
|
104
|
-
| `OWNER` | Zone record owner |
|
|
105
|
-
| `TTL` | Zone record TTL. |
|
|
106
|
-
| `TYPE` | Zone record type name. |
|
|
107
|
-
| `DATA` | Configuration item/zone record data. |
|
|
108
|
-
| `FILTERS` | Command options or filters for output data processing. |
|
|
88
|
+
| Section name | `send_block()` arg name | Description |
|
|
89
|
+
| ------------ | ----------------------- | ------------------------------------------------------ |
|
|
90
|
+
| `COMMAND` | cmd | Command name. |
|
|
91
|
+
| `FLAGS` | flags | Command flags. |
|
|
92
|
+
| `ERROR` | *n/a* | Error message. Only sent by the server. |
|
|
93
|
+
| `SECTION` | section | Configuration section name. |
|
|
94
|
+
| `ITEM` | item | Configuration item name. |
|
|
95
|
+
| `ID` | identifier | Configuration item identifier. |
|
|
96
|
+
| `ZONE` | zone | Zone name. |
|
|
97
|
+
| `OWNER` | owner | Zone record owner |
|
|
98
|
+
| `TTL` | ttl | Zone record TTL. |
|
|
99
|
+
| `TYPE` | rtype | Zone record type name. |
|
|
100
|
+
| `DATA` | data | Configuration item/zone record data. |
|
|
101
|
+
| `FILTERS` | filters | Command options or filters for output data processing. |
|
|
109
102
|
|
|
110
103
|
### Commands reference<a id="kctl-cmds"></a>
|
|
111
104
|
|
|
@@ -115,17 +108,19 @@ of the commands' semantics, please consult the
|
|
|
115
108
|
|
|
116
109
|
A concise notation is used for command synopsis:
|
|
117
110
|
|
|
118
|
-
|
|
119
|
-
cmd-name
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
111
|
+
```
|
|
112
|
+
# command "cmd-name" accepts section of type SECTION_NAME and optionally
|
|
113
|
+
# another section of type OPT_SECTION
|
|
114
|
+
cmd-name(SECTION_NAME, [OPT_SECTION])
|
|
115
|
+
|
|
116
|
+
[OPT_SECTION="literal value"], # Optional section with fixed expected value.
|
|
117
|
+
[SECTION1, SECTION2] # Sections must be present together or not at all.
|
|
118
|
+
[PRIMARY, [SECONDARY]] # SECONDARY may only appear if PRIMARY is present.
|
|
119
|
+
SECTION_NAME="option1"|"option2" # Either one or the other literal may be used.
|
|
120
|
+
SECTION_NAME={"asdf"} # Any subset of characters may be used.
|
|
121
|
+
```
|
|
127
122
|
|
|
128
|
-
The
|
|
123
|
+
The `B` flag always represents an option to execute in blocking mode.
|
|
129
124
|
|
|
130
125
|
#### Server
|
|
131
126
|
|
|
@@ -138,23 +133,23 @@ The **`"B"`** flag always represents an option to execute in blocking mode.
|
|
|
138
133
|
|
|
139
134
|
#### Zone events
|
|
140
135
|
|
|
141
|
-
|
|
136
|
+
The following commands apply to all zones if `ZONE` is left empty.
|
|
142
137
|
|
|
143
138
|
* `zone-status([ZONE], [FILTERS={"rstefc"}])`
|
|
144
|
-
+
|
|
139
|
+
+ filters: **r**ole, **s**erial, **t**ransaction, **e**vents, **f**reeze, **c**atalog <!-- , **u**nixtime -->
|
|
145
140
|
* `zone-reload([ZONE], [FLAGS={"BF"}])`
|
|
146
|
-
+
|
|
141
|
+
+ the `F` flag commands to also reload modules
|
|
147
142
|
* `zone-refresh([ZONE], [FLAGS="B"])`
|
|
148
143
|
* `zone-retransfer([ZONE], [FLAGS="B"])`
|
|
149
144
|
* `zone-notify([ZONE], [FLAGS="B"])`
|
|
150
145
|
* `zone-flush([ZONE], [FILTERS="d", DATA], [FLAGS="B"])`
|
|
151
|
-
+ the
|
|
146
|
+
+ the output**d**ir filter commands that zone(s) be flushed to path stored in the `DATA` section
|
|
152
147
|
* `zone-backup([ZONE], [FILTERS={"dzjtkocqZJTKOCQ"}, [DATA]], [FLAGS="B"])`
|
|
153
|
-
+
|
|
154
|
-
-
|
|
155
|
-
-
|
|
156
|
-
- negative counterparts (eg.
|
|
157
|
-
* `zone-restore`
|
|
148
|
+
+ filters
|
|
149
|
+
- the backup**d**ir filter commands that backups be made to path stored in the `DATA` section
|
|
150
|
+
- **z**onefile, **j**ournal, **t**imers, **k**aspdb, keys**o**nly, **c**atalog, **q**uic
|
|
151
|
+
- negative counterparts (eg. no**Z**onefile) are symmetrical and capitalized
|
|
152
|
+
* `zone-restore` *analogous to `zone-backup`*
|
|
158
153
|
* `zone-sign([ZONE], [FLAGS="B"])`
|
|
159
154
|
* `zone-validate([ZONE], [FLAGS="B"])`
|
|
160
155
|
* `zone-keys-load([ZONE], [FLAGS="B"])`
|
|
@@ -167,42 +162,71 @@ The **`"B"`** flag always represents an option to execute in blocking mode.
|
|
|
167
162
|
|
|
168
163
|
#### Zone editing
|
|
169
164
|
|
|
170
|
-
Use
|
|
165
|
+
Use `@` as `OWNER` if you want to denote `ZONE` itself as the owner.
|
|
171
166
|
|
|
172
167
|
* `zone-read([ZONE], [OWNER], [TYPE])`
|
|
173
168
|
+ if `ZONE` is left empty all zones are read
|
|
174
|
-
* `zone-begin(ZONE)`
|
|
169
|
+
* `zone-begin(ZONE, [FILTERS="b"])`
|
|
170
|
+
+ filters: **b**enevolent
|
|
175
171
|
* `zone-commit(ZONE)`
|
|
176
172
|
* `zone-abort(ZONE)`
|
|
177
173
|
* `zone-diff(ZONE)`
|
|
178
|
-
* `zone-get(ZONE, [OWNER], [TYPE])`
|
|
174
|
+
* `zone-get(ZONE, [OWNER], [TYPE])`
|
|
179
175
|
* `zone-set(ZONE, OWNER, [TTL], TYPE, DATA)`
|
|
180
176
|
* `zone-unset(ZONE, OWNER, [TYPE, [DATA]])`
|
|
181
177
|
* `zone-purge(ZONE, [FILTERS={ocejktf}], [FLAGS="B"])`
|
|
182
|
-
+
|
|
178
|
+
+ filters: **o**rphan, **c**atalog, **e**xpire, **j**ournal, **k**aspdb, **t**imers, zone**f**ile
|
|
183
179
|
* `zone-stats(ZONE, [SECTION], [ITEM], [FLAGS="F"])`
|
|
184
180
|
+ `SECTION` stores the module, `ITEM` stores the counter
|
|
185
181
|
+ the `F` flag specifies to include 0 counters in server's response
|
|
186
182
|
|
|
187
183
|
#### Configuration
|
|
188
184
|
|
|
189
|
-
|
|
185
|
+
For the following commands:
|
|
190
186
|
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
· `ITEM` holds the configuration item name (eg. `storage`)<br/>
|
|
187
|
+
* `SECTION` holds the configuration section name (eg. `template`)
|
|
188
|
+
* `ID` holds the configuration id (eg. `default`)
|
|
189
|
+
* `ITEM` holds the configuration item name (eg. `storage`)
|
|
195
190
|
|
|
196
|
-
|
|
191
|
+
<!-- hacky comment to separate markdown lists -->
|
|
192
|
+
|
|
193
|
+
* `conf-list([SECTION, [ID], [ITEM]], [FILTERS="z"|{"st"}])`
|
|
194
|
+
+ filters:
|
|
195
|
+
- **z**one: list all zone names, including those from the catalog
|
|
196
|
+
- li**s**t: list configuration section items instead of its identifiers
|
|
197
|
+
- **t**ransaction: If a transaction is open (`conf-begin`) queries the
|
|
198
|
+
transaction's configuration schema instead of the server's
|
|
197
199
|
* `conf-read([SECTION, [ID], [ITEM]])`
|
|
198
200
|
* `conf-begin()`
|
|
199
201
|
* `conf-commit()`
|
|
200
202
|
* `conf-abort()`
|
|
201
203
|
* `conf-diff([SECTION, [ID], [ITEM]])`
|
|
202
204
|
* `conf-get([SECTION, [ID], [ITEM]])`
|
|
203
|
-
* `conf-set(SECTION, ID, ITEM, [DATA]
|
|
205
|
+
* `conf-set(SECTION, ID, ITEM, [DATA])`
|
|
204
206
|
* `conf-unset([SECTION, [ID], [ITEM]], [DATA])`
|
|
205
207
|
|
|
208
|
+
### Control usage<a id="control-usage"></a>
|
|
209
|
+
|
|
210
|
+
The module usage consists of several steps:
|
|
211
|
+
|
|
212
|
+
* Initialization and connection to the daemon control socket.
|
|
213
|
+
* One or more control operations. An operation is called by sending a command
|
|
214
|
+
with optional data to the daemon. The operation result has to be received
|
|
215
|
+
afterwards.
|
|
216
|
+
* Closing the connection and deinitialization.
|
|
217
|
+
|
|
218
|
+
#### Sending
|
|
219
|
+
|
|
220
|
+
There are two methods on the `KnotCtl` class which send data to the socket.
|
|
221
|
+
|
|
222
|
+
`KnotCtl.send(KnotCtlType, KnotCtlData)` is the more rudimentary one. It only
|
|
223
|
+
sends the section identifier along with its data, if any are provided. When
|
|
224
|
+
using this function users must beware of the different characteristics
|
|
225
|
+
regarding buffering of different unit types.
|
|
226
|
+
|
|
227
|
+
`KnotCtl.send_block(...)` is more convenient in that it always flushes by
|
|
228
|
+
sending a `BLOCK` unit. Otherwise the two methods are functionally equivalent.
|
|
229
|
+
|
|
206
230
|
### Control examples<a id="control-examples"></a>
|
|
207
231
|
|
|
208
232
|
```python3
|
|
@@ -6,9 +6,9 @@ A Python interface for managing the Knot DNS daemon.
|
|
|
6
6
|
|
|
7
7
|
* [Introduction](#introduction)
|
|
8
8
|
* [Control module](#control-module)
|
|
9
|
-
+ [Usage](#control-usage)
|
|
10
9
|
+ [Protocol reference](#kctl-proto)
|
|
11
10
|
+ [Commands reference](#kctl-cmds)
|
|
11
|
+
+ [Usage](#control-usage)
|
|
12
12
|
+ [Examples](#control-examples)
|
|
13
13
|
* [Probe module](#probe-module)
|
|
14
14
|
+ [Probe usage](#probe-usage)
|
|
@@ -36,25 +36,15 @@ i.e. communication via a Unix socket.
|
|
|
36
36
|
|
|
37
37
|
The module API is stored in `libknot.control`.
|
|
38
38
|
|
|
39
|
-
### Control usage<a id="control-usage"></a>
|
|
40
|
-
|
|
41
|
-
The module usage consists of several steps:
|
|
42
|
-
|
|
43
|
-
* Initialization and connection to the daemon control socket.
|
|
44
|
-
* One or more control operations. An operation is called by sending a command
|
|
45
|
-
with optional data to the daemon. The operation result has to be received
|
|
46
|
-
afterwards.
|
|
47
|
-
* Closing the connection and deinitialization.
|
|
48
|
-
|
|
49
39
|
### Protocol overview<a id="kctl-proto"></a>
|
|
50
40
|
|
|
51
41
|
Connections are supposed to be short-lived, because maintaining a passive
|
|
52
|
-
connection is costly for the server. Therefore the expected usage of the
|
|
42
|
+
connection is costly for the server. Therefore the expected usage of the CTL
|
|
53
43
|
interface is to always open a new connection on demand, then close it once it's
|
|
54
44
|
not immediately needed.
|
|
55
45
|
|
|
56
|
-
Messages are composed of units. These are of four types
|
|
57
|
-
defined in `libknot.control.KnotCtlType`:
|
|
46
|
+
Messages are composed of units. These are of four types the identifiers of
|
|
47
|
+
which are defined in `libknot.control.KnotCtlType`:
|
|
58
48
|
|
|
59
49
|
| Type | Description | IO action |
|
|
60
50
|
| ------- | ---------------------------------------------------------- | --------- |
|
|
@@ -63,6 +53,9 @@ defined in `libknot.control.KnotCtlType`:
|
|
|
63
53
|
| `EXTRA` | Additional data. | cache |
|
|
64
54
|
| `BLOCK` | End of data block. | flush |
|
|
65
55
|
|
|
56
|
+
`DATA` and `EXTRA` units aren't immediately sent, rather they're buffered and
|
|
57
|
+
then sent along with the next `END` or `BLOCK` unit.
|
|
58
|
+
|
|
66
59
|
A unit can optionaly hold data, though this is only meaningful for the `DATA`
|
|
67
60
|
and `EXTRA` types. The data consists of several sections of which usually only
|
|
68
61
|
a few at a time will be present. For example when a unit issuing a `stats`
|
|
@@ -70,20 +63,20 @@ command is sent, there is no reason for it to contain an `ERROR` section.
|
|
|
70
63
|
|
|
71
64
|
The data section identifiers are defined in `libknot.control.KnotCtlDataIdx`:
|
|
72
65
|
|
|
73
|
-
| Section name | Description |
|
|
74
|
-
| ------------ | ------------------------------------------------------ |
|
|
75
|
-
| `COMMAND` | Command name. |
|
|
76
|
-
| `FLAGS` | Command flags. |
|
|
77
|
-
| `ERROR` | Error message.
|
|
78
|
-
| `SECTION` | Configuration section name. |
|
|
79
|
-
| `ITEM` | Configuration item name. |
|
|
80
|
-
| `ID` | Configuration item identifier. |
|
|
81
|
-
| `ZONE` | Zone name. |
|
|
82
|
-
| `OWNER` | Zone record owner |
|
|
83
|
-
| `TTL` | Zone record TTL. |
|
|
84
|
-
| `TYPE` | Zone record type name. |
|
|
85
|
-
| `DATA` | Configuration item/zone record data. |
|
|
86
|
-
| `FILTERS` | Command options or filters for output data processing. |
|
|
66
|
+
| Section name | `send_block()` arg name | Description |
|
|
67
|
+
| ------------ | ----------------------- | ------------------------------------------------------ |
|
|
68
|
+
| `COMMAND` | cmd | Command name. |
|
|
69
|
+
| `FLAGS` | flags | Command flags. |
|
|
70
|
+
| `ERROR` | *n/a* | Error message. Only sent by the server. |
|
|
71
|
+
| `SECTION` | section | Configuration section name. |
|
|
72
|
+
| `ITEM` | item | Configuration item name. |
|
|
73
|
+
| `ID` | identifier | Configuration item identifier. |
|
|
74
|
+
| `ZONE` | zone | Zone name. |
|
|
75
|
+
| `OWNER` | owner | Zone record owner |
|
|
76
|
+
| `TTL` | ttl | Zone record TTL. |
|
|
77
|
+
| `TYPE` | rtype | Zone record type name. |
|
|
78
|
+
| `DATA` | data | Configuration item/zone record data. |
|
|
79
|
+
| `FILTERS` | filters | Command options or filters for output data processing. |
|
|
87
80
|
|
|
88
81
|
### Commands reference<a id="kctl-cmds"></a>
|
|
89
82
|
|
|
@@ -93,17 +86,19 @@ of the commands' semantics, please consult the
|
|
|
93
86
|
|
|
94
87
|
A concise notation is used for command synopsis:
|
|
95
88
|
|
|
96
|
-
|
|
97
|
-
cmd-name
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
89
|
+
```
|
|
90
|
+
# command "cmd-name" accepts section of type SECTION_NAME and optionally
|
|
91
|
+
# another section of type OPT_SECTION
|
|
92
|
+
cmd-name(SECTION_NAME, [OPT_SECTION])
|
|
93
|
+
|
|
94
|
+
[OPT_SECTION="literal value"], # Optional section with fixed expected value.
|
|
95
|
+
[SECTION1, SECTION2] # Sections must be present together or not at all.
|
|
96
|
+
[PRIMARY, [SECONDARY]] # SECONDARY may only appear if PRIMARY is present.
|
|
97
|
+
SECTION_NAME="option1"|"option2" # Either one or the other literal may be used.
|
|
98
|
+
SECTION_NAME={"asdf"} # Any subset of characters may be used.
|
|
99
|
+
```
|
|
105
100
|
|
|
106
|
-
The
|
|
101
|
+
The `B` flag always represents an option to execute in blocking mode.
|
|
107
102
|
|
|
108
103
|
#### Server
|
|
109
104
|
|
|
@@ -116,23 +111,23 @@ The **`"B"`** flag always represents an option to execute in blocking mode.
|
|
|
116
111
|
|
|
117
112
|
#### Zone events
|
|
118
113
|
|
|
119
|
-
|
|
114
|
+
The following commands apply to all zones if `ZONE` is left empty.
|
|
120
115
|
|
|
121
116
|
* `zone-status([ZONE], [FILTERS={"rstefc"}])`
|
|
122
|
-
+
|
|
117
|
+
+ filters: **r**ole, **s**erial, **t**ransaction, **e**vents, **f**reeze, **c**atalog <!-- , **u**nixtime -->
|
|
123
118
|
* `zone-reload([ZONE], [FLAGS={"BF"}])`
|
|
124
|
-
+
|
|
119
|
+
+ the `F` flag commands to also reload modules
|
|
125
120
|
* `zone-refresh([ZONE], [FLAGS="B"])`
|
|
126
121
|
* `zone-retransfer([ZONE], [FLAGS="B"])`
|
|
127
122
|
* `zone-notify([ZONE], [FLAGS="B"])`
|
|
128
123
|
* `zone-flush([ZONE], [FILTERS="d", DATA], [FLAGS="B"])`
|
|
129
|
-
+ the
|
|
124
|
+
+ the output**d**ir filter commands that zone(s) be flushed to path stored in the `DATA` section
|
|
130
125
|
* `zone-backup([ZONE], [FILTERS={"dzjtkocqZJTKOCQ"}, [DATA]], [FLAGS="B"])`
|
|
131
|
-
+
|
|
132
|
-
-
|
|
133
|
-
-
|
|
134
|
-
- negative counterparts (eg.
|
|
135
|
-
* `zone-restore`
|
|
126
|
+
+ filters
|
|
127
|
+
- the backup**d**ir filter commands that backups be made to path stored in the `DATA` section
|
|
128
|
+
- **z**onefile, **j**ournal, **t**imers, **k**aspdb, keys**o**nly, **c**atalog, **q**uic
|
|
129
|
+
- negative counterparts (eg. no**Z**onefile) are symmetrical and capitalized
|
|
130
|
+
* `zone-restore` *analogous to `zone-backup`*
|
|
136
131
|
* `zone-sign([ZONE], [FLAGS="B"])`
|
|
137
132
|
* `zone-validate([ZONE], [FLAGS="B"])`
|
|
138
133
|
* `zone-keys-load([ZONE], [FLAGS="B"])`
|
|
@@ -145,42 +140,71 @@ The **`"B"`** flag always represents an option to execute in blocking mode.
|
|
|
145
140
|
|
|
146
141
|
#### Zone editing
|
|
147
142
|
|
|
148
|
-
Use
|
|
143
|
+
Use `@` as `OWNER` if you want to denote `ZONE` itself as the owner.
|
|
149
144
|
|
|
150
145
|
* `zone-read([ZONE], [OWNER], [TYPE])`
|
|
151
146
|
+ if `ZONE` is left empty all zones are read
|
|
152
|
-
* `zone-begin(ZONE)`
|
|
147
|
+
* `zone-begin(ZONE, [FILTERS="b"])`
|
|
148
|
+
+ filters: **b**enevolent
|
|
153
149
|
* `zone-commit(ZONE)`
|
|
154
150
|
* `zone-abort(ZONE)`
|
|
155
151
|
* `zone-diff(ZONE)`
|
|
156
|
-
* `zone-get(ZONE, [OWNER], [TYPE])`
|
|
152
|
+
* `zone-get(ZONE, [OWNER], [TYPE])`
|
|
157
153
|
* `zone-set(ZONE, OWNER, [TTL], TYPE, DATA)`
|
|
158
154
|
* `zone-unset(ZONE, OWNER, [TYPE, [DATA]])`
|
|
159
155
|
* `zone-purge(ZONE, [FILTERS={ocejktf}], [FLAGS="B"])`
|
|
160
|
-
+
|
|
156
|
+
+ filters: **o**rphan, **c**atalog, **e**xpire, **j**ournal, **k**aspdb, **t**imers, zone**f**ile
|
|
161
157
|
* `zone-stats(ZONE, [SECTION], [ITEM], [FLAGS="F"])`
|
|
162
158
|
+ `SECTION` stores the module, `ITEM` stores the counter
|
|
163
159
|
+ the `F` flag specifies to include 0 counters in server's response
|
|
164
160
|
|
|
165
161
|
#### Configuration
|
|
166
162
|
|
|
167
|
-
|
|
163
|
+
For the following commands:
|
|
168
164
|
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
· `ITEM` holds the configuration item name (eg. `storage`)<br/>
|
|
165
|
+
* `SECTION` holds the configuration section name (eg. `template`)
|
|
166
|
+
* `ID` holds the configuration id (eg. `default`)
|
|
167
|
+
* `ITEM` holds the configuration item name (eg. `storage`)
|
|
173
168
|
|
|
174
|
-
|
|
169
|
+
<!-- hacky comment to separate markdown lists -->
|
|
170
|
+
|
|
171
|
+
* `conf-list([SECTION, [ID], [ITEM]], [FILTERS="z"|{"st"}])`
|
|
172
|
+
+ filters:
|
|
173
|
+
- **z**one: list all zone names, including those from the catalog
|
|
174
|
+
- li**s**t: list configuration section items instead of its identifiers
|
|
175
|
+
- **t**ransaction: If a transaction is open (`conf-begin`) queries the
|
|
176
|
+
transaction's configuration schema instead of the server's
|
|
175
177
|
* `conf-read([SECTION, [ID], [ITEM]])`
|
|
176
178
|
* `conf-begin()`
|
|
177
179
|
* `conf-commit()`
|
|
178
180
|
* `conf-abort()`
|
|
179
181
|
* `conf-diff([SECTION, [ID], [ITEM]])`
|
|
180
182
|
* `conf-get([SECTION, [ID], [ITEM]])`
|
|
181
|
-
* `conf-set(SECTION, ID, ITEM, [DATA]
|
|
183
|
+
* `conf-set(SECTION, ID, ITEM, [DATA])`
|
|
182
184
|
* `conf-unset([SECTION, [ID], [ITEM]], [DATA])`
|
|
183
185
|
|
|
186
|
+
### Control usage<a id="control-usage"></a>
|
|
187
|
+
|
|
188
|
+
The module usage consists of several steps:
|
|
189
|
+
|
|
190
|
+
* Initialization and connection to the daemon control socket.
|
|
191
|
+
* One or more control operations. An operation is called by sending a command
|
|
192
|
+
with optional data to the daemon. The operation result has to be received
|
|
193
|
+
afterwards.
|
|
194
|
+
* Closing the connection and deinitialization.
|
|
195
|
+
|
|
196
|
+
#### Sending
|
|
197
|
+
|
|
198
|
+
There are two methods on the `KnotCtl` class which send data to the socket.
|
|
199
|
+
|
|
200
|
+
`KnotCtl.send(KnotCtlType, KnotCtlData)` is the more rudimentary one. It only
|
|
201
|
+
sends the section identifier along with its data, if any are provided. When
|
|
202
|
+
using this function users must beware of the different characteristics
|
|
203
|
+
regarding buffering of different unit types.
|
|
204
|
+
|
|
205
|
+
`KnotCtl.send_block(...)` is more convenient in that it always flushes by
|
|
206
|
+
sending a `BLOCK` unit. Otherwise the two methods are functionally equivalent.
|
|
207
|
+
|
|
184
208
|
### Control examples<a id="control-examples"></a>
|
|
185
209
|
|
|
186
210
|
```python3
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: libknot
|
|
3
|
-
Version: 3.3.
|
|
3
|
+
Version: 3.3.15.dev0
|
|
4
4
|
Summary: Python bindings for libknot
|
|
5
5
|
Home-page: https://gitlab.nic.cz/knot/knot-dns/-/tree/master/python/libknot
|
|
6
6
|
Author: CZ.NIC, z.s.p.o.
|
|
@@ -28,9 +28,9 @@ A Python interface for managing the Knot DNS daemon.
|
|
|
28
28
|
|
|
29
29
|
* [Introduction](#introduction)
|
|
30
30
|
* [Control module](#control-module)
|
|
31
|
-
+ [Usage](#control-usage)
|
|
32
31
|
+ [Protocol reference](#kctl-proto)
|
|
33
32
|
+ [Commands reference](#kctl-cmds)
|
|
33
|
+
+ [Usage](#control-usage)
|
|
34
34
|
+ [Examples](#control-examples)
|
|
35
35
|
* [Probe module](#probe-module)
|
|
36
36
|
+ [Probe usage](#probe-usage)
|
|
@@ -58,25 +58,15 @@ i.e. communication via a Unix socket.
|
|
|
58
58
|
|
|
59
59
|
The module API is stored in `libknot.control`.
|
|
60
60
|
|
|
61
|
-
### Control usage<a id="control-usage"></a>
|
|
62
|
-
|
|
63
|
-
The module usage consists of several steps:
|
|
64
|
-
|
|
65
|
-
* Initialization and connection to the daemon control socket.
|
|
66
|
-
* One or more control operations. An operation is called by sending a command
|
|
67
|
-
with optional data to the daemon. The operation result has to be received
|
|
68
|
-
afterwards.
|
|
69
|
-
* Closing the connection and deinitialization.
|
|
70
|
-
|
|
71
61
|
### Protocol overview<a id="kctl-proto"></a>
|
|
72
62
|
|
|
73
63
|
Connections are supposed to be short-lived, because maintaining a passive
|
|
74
|
-
connection is costly for the server. Therefore the expected usage of the
|
|
64
|
+
connection is costly for the server. Therefore the expected usage of the CTL
|
|
75
65
|
interface is to always open a new connection on demand, then close it once it's
|
|
76
66
|
not immediately needed.
|
|
77
67
|
|
|
78
|
-
Messages are composed of units. These are of four types
|
|
79
|
-
defined in `libknot.control.KnotCtlType`:
|
|
68
|
+
Messages are composed of units. These are of four types the identifiers of
|
|
69
|
+
which are defined in `libknot.control.KnotCtlType`:
|
|
80
70
|
|
|
81
71
|
| Type | Description | IO action |
|
|
82
72
|
| ------- | ---------------------------------------------------------- | --------- |
|
|
@@ -85,6 +75,9 @@ defined in `libknot.control.KnotCtlType`:
|
|
|
85
75
|
| `EXTRA` | Additional data. | cache |
|
|
86
76
|
| `BLOCK` | End of data block. | flush |
|
|
87
77
|
|
|
78
|
+
`DATA` and `EXTRA` units aren't immediately sent, rather they're buffered and
|
|
79
|
+
then sent along with the next `END` or `BLOCK` unit.
|
|
80
|
+
|
|
88
81
|
A unit can optionaly hold data, though this is only meaningful for the `DATA`
|
|
89
82
|
and `EXTRA` types. The data consists of several sections of which usually only
|
|
90
83
|
a few at a time will be present. For example when a unit issuing a `stats`
|
|
@@ -92,20 +85,20 @@ command is sent, there is no reason for it to contain an `ERROR` section.
|
|
|
92
85
|
|
|
93
86
|
The data section identifiers are defined in `libknot.control.KnotCtlDataIdx`:
|
|
94
87
|
|
|
95
|
-
| Section name | Description |
|
|
96
|
-
| ------------ | ------------------------------------------------------ |
|
|
97
|
-
| `COMMAND` | Command name. |
|
|
98
|
-
| `FLAGS` | Command flags. |
|
|
99
|
-
| `ERROR` | Error message.
|
|
100
|
-
| `SECTION` | Configuration section name. |
|
|
101
|
-
| `ITEM` | Configuration item name. |
|
|
102
|
-
| `ID` | Configuration item identifier. |
|
|
103
|
-
| `ZONE` | Zone name. |
|
|
104
|
-
| `OWNER` | Zone record owner |
|
|
105
|
-
| `TTL` | Zone record TTL. |
|
|
106
|
-
| `TYPE` | Zone record type name. |
|
|
107
|
-
| `DATA` | Configuration item/zone record data. |
|
|
108
|
-
| `FILTERS` | Command options or filters for output data processing. |
|
|
88
|
+
| Section name | `send_block()` arg name | Description |
|
|
89
|
+
| ------------ | ----------------------- | ------------------------------------------------------ |
|
|
90
|
+
| `COMMAND` | cmd | Command name. |
|
|
91
|
+
| `FLAGS` | flags | Command flags. |
|
|
92
|
+
| `ERROR` | *n/a* | Error message. Only sent by the server. |
|
|
93
|
+
| `SECTION` | section | Configuration section name. |
|
|
94
|
+
| `ITEM` | item | Configuration item name. |
|
|
95
|
+
| `ID` | identifier | Configuration item identifier. |
|
|
96
|
+
| `ZONE` | zone | Zone name. |
|
|
97
|
+
| `OWNER` | owner | Zone record owner |
|
|
98
|
+
| `TTL` | ttl | Zone record TTL. |
|
|
99
|
+
| `TYPE` | rtype | Zone record type name. |
|
|
100
|
+
| `DATA` | data | Configuration item/zone record data. |
|
|
101
|
+
| `FILTERS` | filters | Command options or filters for output data processing. |
|
|
109
102
|
|
|
110
103
|
### Commands reference<a id="kctl-cmds"></a>
|
|
111
104
|
|
|
@@ -115,17 +108,19 @@ of the commands' semantics, please consult the
|
|
|
115
108
|
|
|
116
109
|
A concise notation is used for command synopsis:
|
|
117
110
|
|
|
118
|
-
|
|
119
|
-
cmd-name
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
111
|
+
```
|
|
112
|
+
# command "cmd-name" accepts section of type SECTION_NAME and optionally
|
|
113
|
+
# another section of type OPT_SECTION
|
|
114
|
+
cmd-name(SECTION_NAME, [OPT_SECTION])
|
|
115
|
+
|
|
116
|
+
[OPT_SECTION="literal value"], # Optional section with fixed expected value.
|
|
117
|
+
[SECTION1, SECTION2] # Sections must be present together or not at all.
|
|
118
|
+
[PRIMARY, [SECONDARY]] # SECONDARY may only appear if PRIMARY is present.
|
|
119
|
+
SECTION_NAME="option1"|"option2" # Either one or the other literal may be used.
|
|
120
|
+
SECTION_NAME={"asdf"} # Any subset of characters may be used.
|
|
121
|
+
```
|
|
127
122
|
|
|
128
|
-
The
|
|
123
|
+
The `B` flag always represents an option to execute in blocking mode.
|
|
129
124
|
|
|
130
125
|
#### Server
|
|
131
126
|
|
|
@@ -138,23 +133,23 @@ The **`"B"`** flag always represents an option to execute in blocking mode.
|
|
|
138
133
|
|
|
139
134
|
#### Zone events
|
|
140
135
|
|
|
141
|
-
|
|
136
|
+
The following commands apply to all zones if `ZONE` is left empty.
|
|
142
137
|
|
|
143
138
|
* `zone-status([ZONE], [FILTERS={"rstefc"}])`
|
|
144
|
-
+
|
|
139
|
+
+ filters: **r**ole, **s**erial, **t**ransaction, **e**vents, **f**reeze, **c**atalog <!-- , **u**nixtime -->
|
|
145
140
|
* `zone-reload([ZONE], [FLAGS={"BF"}])`
|
|
146
|
-
+
|
|
141
|
+
+ the `F` flag commands to also reload modules
|
|
147
142
|
* `zone-refresh([ZONE], [FLAGS="B"])`
|
|
148
143
|
* `zone-retransfer([ZONE], [FLAGS="B"])`
|
|
149
144
|
* `zone-notify([ZONE], [FLAGS="B"])`
|
|
150
145
|
* `zone-flush([ZONE], [FILTERS="d", DATA], [FLAGS="B"])`
|
|
151
|
-
+ the
|
|
146
|
+
+ the output**d**ir filter commands that zone(s) be flushed to path stored in the `DATA` section
|
|
152
147
|
* `zone-backup([ZONE], [FILTERS={"dzjtkocqZJTKOCQ"}, [DATA]], [FLAGS="B"])`
|
|
153
|
-
+
|
|
154
|
-
-
|
|
155
|
-
-
|
|
156
|
-
- negative counterparts (eg.
|
|
157
|
-
* `zone-restore`
|
|
148
|
+
+ filters
|
|
149
|
+
- the backup**d**ir filter commands that backups be made to path stored in the `DATA` section
|
|
150
|
+
- **z**onefile, **j**ournal, **t**imers, **k**aspdb, keys**o**nly, **c**atalog, **q**uic
|
|
151
|
+
- negative counterparts (eg. no**Z**onefile) are symmetrical and capitalized
|
|
152
|
+
* `zone-restore` *analogous to `zone-backup`*
|
|
158
153
|
* `zone-sign([ZONE], [FLAGS="B"])`
|
|
159
154
|
* `zone-validate([ZONE], [FLAGS="B"])`
|
|
160
155
|
* `zone-keys-load([ZONE], [FLAGS="B"])`
|
|
@@ -167,42 +162,71 @@ The **`"B"`** flag always represents an option to execute in blocking mode.
|
|
|
167
162
|
|
|
168
163
|
#### Zone editing
|
|
169
164
|
|
|
170
|
-
Use
|
|
165
|
+
Use `@` as `OWNER` if you want to denote `ZONE` itself as the owner.
|
|
171
166
|
|
|
172
167
|
* `zone-read([ZONE], [OWNER], [TYPE])`
|
|
173
168
|
+ if `ZONE` is left empty all zones are read
|
|
174
|
-
* `zone-begin(ZONE)`
|
|
169
|
+
* `zone-begin(ZONE, [FILTERS="b"])`
|
|
170
|
+
+ filters: **b**enevolent
|
|
175
171
|
* `zone-commit(ZONE)`
|
|
176
172
|
* `zone-abort(ZONE)`
|
|
177
173
|
* `zone-diff(ZONE)`
|
|
178
|
-
* `zone-get(ZONE, [OWNER], [TYPE])`
|
|
174
|
+
* `zone-get(ZONE, [OWNER], [TYPE])`
|
|
179
175
|
* `zone-set(ZONE, OWNER, [TTL], TYPE, DATA)`
|
|
180
176
|
* `zone-unset(ZONE, OWNER, [TYPE, [DATA]])`
|
|
181
177
|
* `zone-purge(ZONE, [FILTERS={ocejktf}], [FLAGS="B"])`
|
|
182
|
-
+
|
|
178
|
+
+ filters: **o**rphan, **c**atalog, **e**xpire, **j**ournal, **k**aspdb, **t**imers, zone**f**ile
|
|
183
179
|
* `zone-stats(ZONE, [SECTION], [ITEM], [FLAGS="F"])`
|
|
184
180
|
+ `SECTION` stores the module, `ITEM` stores the counter
|
|
185
181
|
+ the `F` flag specifies to include 0 counters in server's response
|
|
186
182
|
|
|
187
183
|
#### Configuration
|
|
188
184
|
|
|
189
|
-
|
|
185
|
+
For the following commands:
|
|
190
186
|
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
· `ITEM` holds the configuration item name (eg. `storage`)<br/>
|
|
187
|
+
* `SECTION` holds the configuration section name (eg. `template`)
|
|
188
|
+
* `ID` holds the configuration id (eg. `default`)
|
|
189
|
+
* `ITEM` holds the configuration item name (eg. `storage`)
|
|
195
190
|
|
|
196
|
-
|
|
191
|
+
<!-- hacky comment to separate markdown lists -->
|
|
192
|
+
|
|
193
|
+
* `conf-list([SECTION, [ID], [ITEM]], [FILTERS="z"|{"st"}])`
|
|
194
|
+
+ filters:
|
|
195
|
+
- **z**one: list all zone names, including those from the catalog
|
|
196
|
+
- li**s**t: list configuration section items instead of its identifiers
|
|
197
|
+
- **t**ransaction: If a transaction is open (`conf-begin`) queries the
|
|
198
|
+
transaction's configuration schema instead of the server's
|
|
197
199
|
* `conf-read([SECTION, [ID], [ITEM]])`
|
|
198
200
|
* `conf-begin()`
|
|
199
201
|
* `conf-commit()`
|
|
200
202
|
* `conf-abort()`
|
|
201
203
|
* `conf-diff([SECTION, [ID], [ITEM]])`
|
|
202
204
|
* `conf-get([SECTION, [ID], [ITEM]])`
|
|
203
|
-
* `conf-set(SECTION, ID, ITEM, [DATA]
|
|
205
|
+
* `conf-set(SECTION, ID, ITEM, [DATA])`
|
|
204
206
|
* `conf-unset([SECTION, [ID], [ITEM]], [DATA])`
|
|
205
207
|
|
|
208
|
+
### Control usage<a id="control-usage"></a>
|
|
209
|
+
|
|
210
|
+
The module usage consists of several steps:
|
|
211
|
+
|
|
212
|
+
* Initialization and connection to the daemon control socket.
|
|
213
|
+
* One or more control operations. An operation is called by sending a command
|
|
214
|
+
with optional data to the daemon. The operation result has to be received
|
|
215
|
+
afterwards.
|
|
216
|
+
* Closing the connection and deinitialization.
|
|
217
|
+
|
|
218
|
+
#### Sending
|
|
219
|
+
|
|
220
|
+
There are two methods on the `KnotCtl` class which send data to the socket.
|
|
221
|
+
|
|
222
|
+
`KnotCtl.send(KnotCtlType, KnotCtlData)` is the more rudimentary one. It only
|
|
223
|
+
sends the section identifier along with its data, if any are provided. When
|
|
224
|
+
using this function users must beware of the different characteristics
|
|
225
|
+
regarding buffering of different unit types.
|
|
226
|
+
|
|
227
|
+
`KnotCtl.send_block(...)` is more convenient in that it always flushes by
|
|
228
|
+
sending a `BLOCK` unit. Otherwise the two methods are functionally equivalent.
|
|
229
|
+
|
|
206
230
|
### Control examples<a id="control-examples"></a>
|
|
207
231
|
|
|
208
232
|
```python3
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|