[532] | 1 | ---
|
---|
| 2 | title: Bouncer networks extension
|
---|
| 3 | layout: spec
|
---|
| 4 | work-in-progress: true
|
---|
| 5 | copyrights:
|
---|
| 6 | -
|
---|
| 7 | name: "Darren Whitlen"
|
---|
| 8 | period: "2020"
|
---|
| 9 | email: "darren@kiwiirc.com"
|
---|
| 10 | -
|
---|
| 11 | name: "Simon Ser"
|
---|
| 12 | period: "2021"
|
---|
| 13 | email: "contact@emersion.fr"
|
---|
| 14 | ---
|
---|
| 15 |
|
---|
| 16 | ## Notes for implementing experimental vendor extension
|
---|
| 17 |
|
---|
| 18 | This is an experimental specification for a vendored extension.
|
---|
| 19 |
|
---|
| 20 | No guarantees are made regarding the stability of this extension.
|
---|
| 21 | Backwards-incompatible changes can be made at any time without prior notice.
|
---|
| 22 |
|
---|
| 23 | Software implementing this work-in-progress specification MUST NOT use the
|
---|
| 24 | unprefixed `bouncer-networks` CAP names. Instead, implementations SHOULD use
|
---|
| 25 | the `soju.im/bouncer-networks` CAP names to be interoperable with other software
|
---|
| 26 | implementing a compatible work-in-progress version.
|
---|
| 27 |
|
---|
| 28 | ## Description
|
---|
| 29 |
|
---|
| 30 | This document describes the `bouncer-networks` extension. This enables clients
|
---|
| 31 | to discover servers that are bouncers, list and edit upstream networks the
|
---|
| 32 | bouncer is connected to.
|
---|
| 33 |
|
---|
| 34 | Each network has a unique per-user ID called "netid". It MUST NOT change during
|
---|
| 35 | the lifetime of the network. TODO: character restrictions for network IDs.
|
---|
| 36 |
|
---|
| 37 | Networks also have attributes. Attributes are encoded in the message-tag
|
---|
| 38 | format. Clients MUST ignore unknown attributes.
|
---|
| 39 |
|
---|
| 40 | ## Implementation
|
---|
| 41 |
|
---|
| 42 | The `bouncer-networks` extension defines a new `RPL_ISUPPORT` token and a new
|
---|
| 43 | `BOUNCER` command.
|
---|
| 44 |
|
---|
| 45 | ### `RPL_ISUPPORT` token
|
---|
| 46 |
|
---|
| 47 | The server can advertise a `BOUNCER_NETID` token in its `RPL_ISUPPORT` message.
|
---|
| 48 | Its optional value is the network ID bound for the current connection.
|
---|
| 49 |
|
---|
| 50 | ### `bouncer-networks` batch
|
---|
| 51 |
|
---|
| 52 | The `bouncer-networks` batch does not take any parameter and can only contain
|
---|
| 53 | `BOUNCER NETWORK` messages.
|
---|
| 54 |
|
---|
| 55 | ### `BOUNCER` command
|
---|
| 56 |
|
---|
| 57 | A new `BOUNCER` command is introduced. It has a case-insensitive subcommand:
|
---|
| 58 |
|
---|
| 59 | BOUNCER <subcommand> <params...>
|
---|
| 60 |
|
---|
| 61 | #### `BIND` subcommand
|
---|
| 62 |
|
---|
| 63 | The `BIND` subcommand selects an upstream network to bind to for the lifetime
|
---|
| 64 | of the current connection. Clients can only send it after authentication but
|
---|
| 65 | before the registration completes.
|
---|
| 66 |
|
---|
| 67 | BOUNCER BIND <netid>
|
---|
| 68 |
|
---|
| 69 | #### `LISTNETWORKS` subcommand
|
---|
| 70 |
|
---|
| 71 | The `LISTNETWORKS` subcommand queries the list of upstream networks.
|
---|
| 72 |
|
---|
| 73 | BOUNCER LISTNETWORKS
|
---|
| 74 |
|
---|
| 75 | The server replies with a `bouncer-networks` batch, containing any number of
|
---|
| 76 | `BOUNCER NETWORK` messages:
|
---|
| 77 |
|
---|
| 78 | BOUNCER NETWORK <netid> <attributes>
|
---|
| 79 |
|
---|
| 80 | #### `ADDNETWORK` subcommand
|
---|
| 81 |
|
---|
| 82 | The `ADDNETWORK` subcommand registers a new upstream network in the bouncer.
|
---|
| 83 |
|
---|
| 84 | BOUNCER ADDNETWORK <attributes>
|
---|
| 85 |
|
---|
| 86 | The bouncer MAY reject this new network for any reason, in this case it MUST
|
---|
| 87 | reply with an error. If the request is accepted, the bouncer MUST generate a
|
---|
| 88 | new unique network ID. The bouncer MAY populate unspecified attributes with
|
---|
| 89 | implementation-defined defaults.
|
---|
| 90 |
|
---|
| 91 | Clients MUST specify at least the `host` attribute.
|
---|
| 92 |
|
---|
| 93 | If the client doesn't specify the `tls` attribute, the server SHOULD use the
|
---|
| 94 | default `1`. If the client doesn't specify the `port` attribute, the server
|
---|
| 95 | SHOULD use the default `6697` if `tls=1` or `6667` if `tls=0`.
|
---|
| 96 |
|
---|
| 97 | On success, the server replies with:
|
---|
| 98 |
|
---|
| 99 | BOUNCER ADDNETWORK <netid>
|
---|
| 100 |
|
---|
| 101 | #### `CHANGENETWORK` subcommand
|
---|
| 102 |
|
---|
| 103 | The `CHANGENETWORK` subcommand changes attributes of an existing upstream
|
---|
| 104 | network.
|
---|
| 105 |
|
---|
| 106 | BOUNCER CHANGENETWORK <netid> <attributes>
|
---|
| 107 |
|
---|
| 108 | The bouncer MAY reject the change for any reason, in this case it MUST reply
|
---|
| 109 | with an error. At least one attribute MUST be specified by the client.
|
---|
| 110 |
|
---|
| 111 | On success, the server replies with:
|
---|
| 112 |
|
---|
| 113 | BOUNCER CHANGENETWORK <netid>
|
---|
| 114 |
|
---|
| 115 | #### `DELNETWORK` subcommand
|
---|
| 116 |
|
---|
| 117 | The `DELNETWORK` subcommand removes an existing upstream network.
|
---|
| 118 |
|
---|
| 119 | BOUNCER DELNETWORK <netid>
|
---|
| 120 |
|
---|
| 121 | The bouncer MAY reject the change for any reason, in this case it MUST reply
|
---|
| 122 | with an error.
|
---|
| 123 |
|
---|
| 124 | On success, the server replies with:
|
---|
| 125 |
|
---|
| 126 | BOUNCER DELNETWORK <netid>
|
---|
| 127 |
|
---|
| 128 | ### Network notifications
|
---|
| 129 |
|
---|
| 130 | When a network attributes are updated, the bouncer MUST broadcast a
|
---|
| 131 | `BOUNCER NETWORK` message to all connected clients with the updated attributes:
|
---|
| 132 |
|
---|
| 133 | BOUNCER NETWORK <netid> <attributes>
|
---|
| 134 |
|
---|
| 135 | When a network is removed, the bouncer MUST broadcast a `BOUNCER NETWORK`
|
---|
| 136 | message to all connected clients:
|
---|
| 137 |
|
---|
| 138 | BOUNCER NETWORK <netid> *
|
---|
| 139 |
|
---|
| 140 | ### Errors
|
---|
| 141 |
|
---|
| 142 | Errors are returned using the standard replies syntax. The general syntax is:
|
---|
| 143 |
|
---|
| 144 | FAIL BOUNCER <code> <subcommand> [context...] <description>
|
---|
| 145 |
|
---|
| 146 | If a client sends an unknown subcommand, the server MUST reply with:
|
---|
| 147 |
|
---|
| 148 | FAIL BOUNCER UNKNOWN_COMMAND <subcommand> :Unknown subcommand
|
---|
| 149 |
|
---|
| 150 | #### `ACCOUNT_REQUIRED` error
|
---|
| 151 |
|
---|
| 152 | If a client sends a `BIND` subcommand before authentication, the server MAY
|
---|
| 153 | reply with:
|
---|
| 154 |
|
---|
| 155 | FAIL BOUNCER ACCOUNT_REQUIRED BIND :Authentication required
|
---|
| 156 |
|
---|
| 157 | #### `REGISTRATION_IS_COMPLETED` error
|
---|
| 158 |
|
---|
| 159 | If a client sends a `BIND` subcommand after registration, the server MAY reply
|
---|
| 160 | with:
|
---|
| 161 |
|
---|
| 162 | FAIL BOUNCER REGISTRATION_IS_COMPLETED BIND :Cannot bind to a network after registration
|
---|
| 163 |
|
---|
| 164 | #### `INVALID_NETID` error
|
---|
| 165 |
|
---|
| 166 | If a client sends a subcommand with an invalid network ID, the server MUST
|
---|
| 167 | reply with:
|
---|
| 168 |
|
---|
| 169 | FAIL BOUNCER INVALID_NETID <subcommand> <netid> :Network not found
|
---|
| 170 |
|
---|
| 171 | #### `INVALID_ATTRIBUTE` error
|
---|
| 172 |
|
---|
| 173 | If a client sends an `ADDNETWORK` or a `CHANGENETWORK` subcommand with an
|
---|
| 174 | invalid attribute, the server MUST reply with:
|
---|
| 175 |
|
---|
| 176 | FAIL BOUNCER INVALID_ATTRIBUTE <subcommand> <netid> <attribute> :Invalid attribute value
|
---|
| 177 |
|
---|
| 178 | If the `subcommand` is `ADDNETWORK`, `netid` MUST be set to the special `*`
|
---|
| 179 | value.
|
---|
| 180 |
|
---|
| 181 | #### `READ_ONLY_ATTRIBUTE` error
|
---|
| 182 |
|
---|
| 183 | If a client attempts to change a read-only network attribute using the
|
---|
| 184 | `ADDNETWORK` or `CHANGENETWORK` subcommand, the server MUST reply with:
|
---|
| 185 |
|
---|
| 186 | FAIL BOUNCER READ_ONLY_ATTRIBUTE <subcommand> <netid> <attribute> :Read-only attribute
|
---|
| 187 |
|
---|
| 188 | If the `subcommand` is `ADDNETWORK`, `netid` MUST be set to the special `*`
|
---|
| 189 | value.
|
---|
| 190 |
|
---|
| 191 | #### `UNKNOWN_ATTRIBUTE` error
|
---|
| 192 |
|
---|
| 193 | If a client sends an `ADDNETWORK` or a `CHANGENETWORK` subcommand with an
|
---|
| 194 | unknown attribute, the server MUST reply with:
|
---|
| 195 |
|
---|
| 196 | FAIL BOUNCER UNKNOWN_ATTRIBUTE <subcommand> <netid> <attribute> :Unknown attribute
|
---|
| 197 |
|
---|
| 198 | If the `subcommand` is `ADDNETWORK`, `netid` MUST be set to the special `*`
|
---|
| 199 | value.
|
---|
| 200 |
|
---|
| 201 | #### `NEED_ATTRIBUTE` error
|
---|
| 202 |
|
---|
| 203 | If a client sends an `ADDNETWORK` subcommand without a mandatory attribute, the
|
---|
| 204 | server MUST reply with:
|
---|
| 205 |
|
---|
| 206 | FAIL BOUNCER NEED_ATTRIBUTE ADDNETWORK <attribute> :Missing required attribute
|
---|
| 207 |
|
---|
| 208 | TODO: more errors
|
---|
| 209 |
|
---|
| 210 | ### Standard network attributes
|
---|
| 211 |
|
---|
| 212 | Bouncers MUST recognise the following network attributes:
|
---|
| 213 |
|
---|
| 214 | * `name`: the human-readable name for the network.
|
---|
| 215 | * `state` (read-only): one of `connected`, `connecting` or `disconnected`.
|
---|
| 216 | Indicates the current state of the connection to the upstream network.
|
---|
| 217 | * `host`: the hostname or literal IP address to connect to.
|
---|
| 218 | * `port`: the TCP port to connect to.
|
---|
| 219 | * `tls`: `1` to use a TLS connection, `0` to use a cleartext connection.
|
---|
| 220 | * `nickname`: the nickname to use during registration.
|
---|
| 221 | * `username`: the username to use during registration.
|
---|
| 222 | * `realname`: the realname to use during registration.
|
---|
[533] | 223 | * `pass`: the server password (PASS) to use during registration.
|
---|
[532] | 224 |
|
---|
| 225 | TODO: more attributes
|
---|
| 226 |
|
---|
| 227 | ### Examples
|
---|
| 228 |
|
---|
| 229 | Binding to a network:
|
---|
| 230 |
|
---|
| 231 | C: CAP LS 302
|
---|
| 232 | C: NICK emersion
|
---|
| 233 | C: USER emersion 0 0 :Simon
|
---|
| 234 | S: CAP * LS :sasl=PLAIN bouncer-networks
|
---|
| 235 | C: CAP REQ :sasl bouncer-networks
|
---|
| 236 | [SASL authentication]
|
---|
| 237 | C: BOUNCER BIND 42
|
---|
| 238 | C: CAP END
|
---|
| 239 |
|
---|
| 240 | Listing networks:
|
---|
| 241 |
|
---|
| 242 | C: BOUNCER LISTNETWORKS
|
---|
| 243 | S: BATCH +asdf bouncer-networks
|
---|
| 244 | S: @batch=asdf BOUNCER NETWORK 42 name=Freenode;state=connected
|
---|
| 245 | S: @batch=asdf BOUNCER NETWORK 43 name=My\sAwesome\sNetwork;state=disconnected
|
---|
| 246 | S: BATCH -asdf
|
---|
| 247 |
|
---|
| 248 | Adding a new network:
|
---|
| 249 |
|
---|
| 250 | C: BOUNCER ADDNETWORK name=OFTC;host=irc.oftc.net
|
---|
| 251 | S: BOUNCER NETWORK 44 status=connecting
|
---|
| 252 | S: BOUNCER ADDNETWORK 44
|
---|
| 253 | S: BOUNCER NETWORK 44 status=connected
|
---|
| 254 |
|
---|
| 255 | Changing an existing network:
|
---|
| 256 |
|
---|
| 257 | C: BOUNCER CHANGENETWORK 44 realname=Simon
|
---|
| 258 | S: BOUNCER NETWORK 44 realname=Simon
|
---|
| 259 | S: BOUNCER CHANGENETWORK 44
|
---|
| 260 |
|
---|
| 261 | Removing an existing network:
|
---|
| 262 |
|
---|
| 263 | C: BOUNCER DELNETWORK 44
|
---|
| 264 | S: BOUNCER NETWORK 44 *
|
---|
| 265 | S: BOUNCER DELNETWORK 44
|
---|