mirror of
https://github.com/callebtc/electronwall.git
synced 2025-12-17 07:04:21 +01:00
Merge pull request #19 from LN-Zap/feat/passthrough
Add passthrogh mode
This commit is contained in:
@@ -38,6 +38,10 @@ Edit `config.yaml.example` and rename to `config.yaml`.
|
|||||||
|
|
||||||
# Rules
|
# Rules
|
||||||
|
|
||||||
|
## Passthrough
|
||||||
|
|
||||||
|
The `passthrough` option is a mode for both `ChannelMode` and `ForwardMode` in the `config.yaml` file. When set to `passthrough`, electronwall will not apply any allowlist, denylist, or programmable rules to channel open requests or HTLC forwards. Instead, it will simply pass through all requests without any checks.
|
||||||
|
|
||||||
## Allowlist and denylist
|
## Allowlist and denylist
|
||||||
|
|
||||||
Allowlist and denylist rules are set in `config.yaml` under the appropriate keys. See the [example](config.yaml.example) config.
|
Allowlist and denylist rules are set in `config.yaml` under the appropriate keys. See the [example](config.yaml.example) config.
|
||||||
|
|||||||
@@ -12,9 +12,10 @@ debug: true
|
|||||||
|
|
||||||
# ----- Channel openings -----
|
# ----- Channel openings -----
|
||||||
|
|
||||||
# Mode can either be "denylist" or "allowlist"
|
# Mode can be "denylist", "allowlist", or "passthrough". Only one mode can be active.
|
||||||
# Only one mode can be used at a time, the other list is ignored.
|
# If "denylist" is active, "allowlist" is ignored, and vice versa.
|
||||||
channel-mode: "denylist"
|
# "passthrough" passes all requests through without checks, ignoring both lists.
|
||||||
|
channel-mode: "denylist"
|
||||||
|
|
||||||
# This error message will be sent to the other party upon a reject
|
# This error message will be sent to the other party upon a reject
|
||||||
channel-reject-message: "Contact me at user@email.com"
|
channel-reject-message: "Contact me at user@email.com"
|
||||||
@@ -29,8 +30,9 @@ channel-denylist:
|
|||||||
|
|
||||||
# ----- HTLC forwarding -----
|
# ----- HTLC forwarding -----
|
||||||
|
|
||||||
# Mode can either be "denylist" or "allowlist"
|
# Mode can be "denylist", "allowlist", or "passthrough". Only one mode can be active.
|
||||||
# Only one mode can be used at a time, the other list is ignored.
|
# If "denylist" is active, "allowlist" is ignored, and vice versa.
|
||||||
|
# "passthrough" passes all requests through without checks, ignoring both lists.
|
||||||
forward-mode: "denylist"
|
forward-mode: "denylist"
|
||||||
|
|
||||||
# List of channel IDs to allowlist or denylist
|
# List of channel IDs to allowlist or denylist
|
||||||
|
|||||||
@@ -61,8 +61,8 @@ func checkConfig() {
|
|||||||
if len(Configuration.ChannelMode) == 0 {
|
if len(Configuration.ChannelMode) == 0 {
|
||||||
Configuration.ChannelMode = "denylist"
|
Configuration.ChannelMode = "denylist"
|
||||||
}
|
}
|
||||||
if Configuration.ChannelMode != "allowlist" && Configuration.ChannelMode != "denylist" {
|
if Configuration.ChannelMode != "allowlist" && Configuration.ChannelMode != "denylist" && Configuration.ChannelMode != "passthrough" {
|
||||||
panic(fmt.Errorf("channel mode must be either allowlist or denylist"))
|
panic(fmt.Errorf("channel mode must be either allowlist, denylist or passthrough"))
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Infof("Channel acceptor running in %s mode", Configuration.ChannelMode)
|
log.Infof("Channel acceptor running in %s mode", Configuration.ChannelMode)
|
||||||
@@ -70,9 +70,9 @@ func checkConfig() {
|
|||||||
if len(Configuration.ForwardMode) == 0 {
|
if len(Configuration.ForwardMode) == 0 {
|
||||||
Configuration.ForwardMode = "denylist"
|
Configuration.ForwardMode = "denylist"
|
||||||
}
|
}
|
||||||
if Configuration.ForwardMode != "allowlist" && Configuration.ForwardMode != "denylist" {
|
if Configuration.ForwardMode != "allowlist" && Configuration.ForwardMode != "denylist" && Configuration.ForwardMode != "passthrough" {
|
||||||
panic(fmt.Errorf("channel mode must be either allowlist or denylist"))
|
panic(fmt.Errorf("forward mode must be either allowlist, denylist or passthrough"))
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Infof("HTLC forwarder running in %s mode", Configuration.ForwardMode)
|
log.Infof("HTLC forwarder running in %s mode", Configuration.ForwardMode)
|
||||||
}
|
}
|
||||||
8
main.go
8
main.go
@@ -108,10 +108,14 @@ func main() {
|
|||||||
wg.Add(2)
|
wg.Add(2)
|
||||||
|
|
||||||
// channel acceptor
|
// channel acceptor
|
||||||
app.DispatchChannelAcceptor(ctx)
|
if config.Configuration.ChannelMode != "passthrough" {
|
||||||
|
app.DispatchChannelAcceptor(ctx)
|
||||||
|
}
|
||||||
|
|
||||||
// htlc acceptor
|
// htlc acceptor
|
||||||
app.DispatchHTLCAcceptor(ctx)
|
if config.Configuration.ForwardMode != "passthrough" {
|
||||||
|
app.DispatchHTLCAcceptor(ctx)
|
||||||
|
}
|
||||||
|
|
||||||
wg.Wait()
|
wg.Wait()
|
||||||
log.Info("All routines stopped. Waiting for new connection.")
|
log.Info("All routines stopped. Waiting for new connection.")
|
||||||
|
|||||||
Reference in New Issue
Block a user