Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 0 additions & 18 deletions docs/Aedes.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
- [aedes.unsubscribe (topic, deliverfunc, callback)](#aedesunsubscribe-topic-deliverfunc-callback)
- [aedes.publish (packet, callback)](#aedespublish-packet-callback)
- [aedes.close ([callback])](#aedesclose-callback)
- [Handler: decodeProtocol (client, buffer)](#handler-decodeprotocol-client-buffer)
- [Handler: preConnect (client, packet, callback)](#handler-preconnect-client-packet-callback)
- [Handler: authenticate (client, username, password, callback)](#handler-authenticate-client-username-password-callback)
- [Handler: authorizePublish (client, packet, callback)](#handler-authorizepublish-client-packet-callback)
Expand Down Expand Up @@ -225,23 +224,6 @@ Close aedes server and disconnects all clients.

`callback` will be invoked when server is closed.

## Handler: decodeProtocol (client, buffer)

- client: [`<Client>`](./Client.md)
- buffer: `<Buffer>`

Invoked when aedes instance `trustProxy` is `true`

It targets to decode wrapped protocols (e.g. websocket and PROXY) into plain raw mqtt stream.

`aedes-protocol-decoder` is an example to parse https headers (x-real-ip | x-forwarded-for) and proxy protocol v1 and v2 to retrieve information in `client.connDetails`.

```js
aedes.decodeProtocol = function(client, buffer) {
return yourDecoder(client, buffer)
}
```

## Handler: preConnect (client, packet, callback)

- client: [`<Client>`](./Client.md)
Expand Down
175 changes: 0 additions & 175 deletions examples/proxy/index.js

This file was deleted.

17 changes: 0 additions & 17 deletions examples/proxy/package.json

This file was deleted.

11 changes: 2 additions & 9 deletions lib/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ function Client (broker, conn, req) {
this._nextId = Math.ceil(Math.random() * 65535)

this.req = req
this.connDetails = null
this.connDetails = req ? req.connDetails : null

// we use two variables for the will
// because we store in _will while
Expand Down Expand Up @@ -73,14 +73,7 @@ function Client (broker, conn, req) {
if (that._parsingBatch <= 0) {
that._parsingBatch = 0
var buf = client.conn.read(null)
if (!client.connackSent && client.broker.decodeProtocol && client.broker.trustProxy && buf) {
const { data } = client.broker.decodeProtocol(client, buf)
if (data) {
client._parser.parse(data)
} else {
client._parser.parse(buf)
}
} else if (buf) {
if (buf) {
client._parser.parse(buf)
}
}
Expand Down
2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -108,15 +108,13 @@
"dependencies": {
"aedes-packet": "^2.3.1",
"aedes-persistence": "^8.1.1",
"aedes-protocol-decoder": "^1.0.0",
"bulk-write-stream": "^2.0.1",
"end-of-stream": "^1.4.4",
"fastfall": "^1.5.1",
"fastparallel": "^2.3.0",
"fastseries": "^2.0.0",
"mqemitter": "^4.2.0",
"mqtt-packet": "^6.3.2",
"proxy-protocol-js": "^4.0.4",
"readable-stream": "^3.6.0",
"retimer": "^2.0.0",
"reusify": "^1.0.4",
Expand Down
Loading