Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Winbox matcher #255

Merged
merged 1 commit into from
Oct 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ Current matchers:
- **layer4.matchers.socks5** - matches connections that look like [SOCKSv5](https://www.rfc-editor.org/rfc/rfc1928.html).
- **layer4.matchers.ssh** - matches connections that look like SSH connections.
- **layer4.matchers.tls** - matches connections that start with TLS handshakes. In addition, any [`tls.handshake_match` modules](https://caddyserver.com/docs/modules/) can be used for matching on TLS-specific properties of the ClientHello, such as ServerName (SNI).
- **layer4.matchers.winbox** - matches connections that look like those initiated by [Winbox](https://help.mikrotik.com/docs/display/ROS/WinBox), a graphical tool for MikroTik hardware and software routers management.
- **layer4.matchers.wireguard** - matches connections the look like [WireGuard](https://www.wireguard.com/protocol/) connections.
- **layer4.matchers.xmpp** - matches connections that look like [XMPP](https://xmpp.org/about/technology-overview/).

Expand Down
1 change: 1 addition & 0 deletions imports.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import (
_ "github.com/mholt/caddy-l4/modules/l4tee"
_ "github.com/mholt/caddy-l4/modules/l4throttle"
_ "github.com/mholt/caddy-l4/modules/l4tls"
_ "github.com/mholt/caddy-l4/modules/l4winbox"
_ "github.com/mholt/caddy-l4/modules/l4wireguard"
_ "github.com/mholt/caddy-l4/modules/l4xmpp"
)
85 changes: 85 additions & 0 deletions integration/caddyfile_adapt/gd_matcher_winbox.caddytest
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
{
layer4 {
:443 {
@w1 winbox {
modes standard romon
username toms
}
route @w1 {
proxy 192.168.0.1:8291
}
@w2 winbox {
modes standard
username_regexp ^andris|edgars|juris$
}
route @w2 {
proxy 192.168.0.2:8291
}
}
}
}
----------
{
"apps": {
"layer4": {
"servers": {
"srv0": {
"listen": [
":443"
],
"routes": [
{
"match": [
{
"winbox": {
"modes": [
"standard",
"romon"
],
"username": "toms"
}
}
],
"handle": [
{
"handler": "proxy",
"upstreams": [
{
"dial": [
"192.168.0.1:8291"
]
}
]
}
]
},
{
"match": [
{
"winbox": {
"modes": [
"standard"
],
"username_regexp": "^andris|edgars|juris$"
}
}
],
"handle": [
{
"handler": "proxy",
"upstreams": [
{
"dial": [
"192.168.0.2:8291"
]
}
]
}
]
}
]
}
}
}
}
}
Loading
Loading