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
|
||||
|
||||
## 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 rules are set in `config.yaml` under the appropriate keys. See the [example](config.yaml.example) config.
|
||||
|
||||
@@ -12,8 +12,9 @@ debug: true
|
||||
|
||||
# ----- Channel openings -----
|
||||
|
||||
# Mode can either be "denylist" or "allowlist"
|
||||
# Only one mode can be used at a time, the other list is ignored.
|
||||
# Mode can be "denylist", "allowlist", or "passthrough". Only one mode can be active.
|
||||
# If "denylist" is active, "allowlist" is ignored, and vice versa.
|
||||
# "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
|
||||
@@ -29,8 +30,9 @@ channel-denylist:
|
||||
|
||||
# ----- HTLC forwarding -----
|
||||
|
||||
# Mode can either be "denylist" or "allowlist"
|
||||
# Only one mode can be used at a time, the other list is ignored.
|
||||
# Mode can be "denylist", "allowlist", or "passthrough". Only one mode can be active.
|
||||
# If "denylist" is active, "allowlist" is ignored, and vice versa.
|
||||
# "passthrough" passes all requests through without checks, ignoring both lists.
|
||||
forward-mode: "denylist"
|
||||
|
||||
# List of channel IDs to allowlist or denylist
|
||||
|
||||
@@ -61,8 +61,8 @@ func checkConfig() {
|
||||
if len(Configuration.ChannelMode) == 0 {
|
||||
Configuration.ChannelMode = "denylist"
|
||||
}
|
||||
if Configuration.ChannelMode != "allowlist" && Configuration.ChannelMode != "denylist" {
|
||||
panic(fmt.Errorf("channel mode must be either allowlist or denylist"))
|
||||
if Configuration.ChannelMode != "allowlist" && Configuration.ChannelMode != "denylist" && Configuration.ChannelMode != "passthrough" {
|
||||
panic(fmt.Errorf("channel mode must be either allowlist, denylist or passthrough"))
|
||||
}
|
||||
|
||||
log.Infof("Channel acceptor running in %s mode", Configuration.ChannelMode)
|
||||
@@ -70,8 +70,8 @@ func checkConfig() {
|
||||
if len(Configuration.ForwardMode) == 0 {
|
||||
Configuration.ForwardMode = "denylist"
|
||||
}
|
||||
if Configuration.ForwardMode != "allowlist" && Configuration.ForwardMode != "denylist" {
|
||||
panic(fmt.Errorf("channel mode must be either allowlist or denylist"))
|
||||
if Configuration.ForwardMode != "allowlist" && Configuration.ForwardMode != "denylist" && Configuration.ForwardMode != "passthrough" {
|
||||
panic(fmt.Errorf("forward mode must be either allowlist, denylist or passthrough"))
|
||||
}
|
||||
|
||||
log.Infof("HTLC forwarder running in %s mode", Configuration.ForwardMode)
|
||||
|
||||
4
main.go
4
main.go
@@ -108,10 +108,14 @@ func main() {
|
||||
wg.Add(2)
|
||||
|
||||
// channel acceptor
|
||||
if config.Configuration.ChannelMode != "passthrough" {
|
||||
app.DispatchChannelAcceptor(ctx)
|
||||
}
|
||||
|
||||
// htlc acceptor
|
||||
if config.Configuration.ForwardMode != "passthrough" {
|
||||
app.DispatchHTLCAcceptor(ctx)
|
||||
}
|
||||
|
||||
wg.Wait()
|
||||
log.Info("All routines stopped. Waiting for new connection.")
|
||||
|
||||
Reference in New Issue
Block a user