Skip to content

Commit 6d8cfe2

Browse files
committed
WIP: api/socket: Add Go types for the command-line API socket messages
Even though there aren't many new types, these are fairly different from the rest of the runtime-tools code, and a separate package lets folks pull in only the code they need (assuming they are sophisticated enough to grab only a subset of the Git repository). Still needs a place to store the JSON Schemas [1]. [1]: https://github.com/opencontainers/runtime-spec/pull/513/files#diff-751d571a4cba0b0155c3d3bf793e08e8R13 Signed-off-by: W. Trevor King <[email protected]>
1 parent 2ce4a5d commit 6d8cfe2

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

api/socket/socket.go

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package socket
2+
3+
// Message is the normal data for messages passed on the console socket.
4+
type Message struct {
5+
// Type of message being passed
6+
Type string `json:"type"`
7+
}
8+
9+
// TerminalRequest is the normal data for messages passing a pseudoterminal master.
10+
type TerminalRequest struct {
11+
Message
12+
13+
// Container ID for the container whose pseudoterminal master is being set.
14+
Container string `json:"container"`
15+
}
16+
17+
// Response is the normal data for response messages.
18+
type Response struct {
19+
Message
20+
21+
// Message is a phrase describing the response.
22+
Message string `json:"message,omitempty"`
23+
}

docs/command-line-interface.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ The socket type MUST be [`SOCK_SEQPACKET`][socket-types] or [`SOCK_STREAM`][sock
8585
The server MUST send a single response for each runtime request.
8686
The [normal data][socket-queue] ([`msghdr.msg_iov*`][socket.h]) of all messages MUST be [UTF-8][] [JSON](glossary.md#json).
8787

88-
There are [JSON Schemas](schema/README.md) and [Go bindings](specs-go/socket/socket.go) for the messages specified in this section.
88+
There are [JSON Schemas](schema/README.md FIXME) and [Go bindings](../api/socket/socket.go) for the messages specified in this section.
8989

9090
##### Requests
9191

0 commit comments

Comments
 (0)