-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
NOISSUE - Add support for interceptor (#51)
Signed-off-by: Dusan Borovcanin <[email protected]>
- Loading branch information
1 parent
0ffbc4f
commit 0b102d0
Showing
7 changed files
with
83 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package session | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/eclipse/paho.mqtt.golang/packets" | ||
) | ||
|
||
// Interceptor is an interface for mProxy intercept hook. | ||
type Interceptor interface { | ||
// Intercept is called on every packet flowing through the Proxy. | ||
// Packets can be modified before being sent to the broker or the client. | ||
// If the interceptor returns a non-nil packet, the modified packet is sent. | ||
// The error indicates unsuccessful interception and mProxy is cancelling the packet. | ||
Intercept(ctx context.Context, pkt packets.ControlPacket, dir Direction) (packets.ControlPacket, error) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters