From 17962564faf251a22045ff69ff121d57f668da25 Mon Sep 17 00:00:00 2001 From: Yilun Date: Wed, 16 Mar 2022 02:27:55 -0700 Subject: [PATCH] Add config for percentage based nanopay txn fee Signed-off-by: Yilun --- client.go | 2 ++ config.go | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/client.go b/client.go index 71439c6..27000c1 100644 --- a/client.go +++ b/client.go @@ -129,6 +129,8 @@ func (c *TunaSessionClient) newTunaExit(i int) (*tuna.TunaExit, error) { ReverseRandomPorts: true, ReverseMaxPrice: c.config.TunaMaxPrice, ReverseNanoPayFee: c.config.TunaNanoPayFee, + MinReverseNanoPayFee: c.config.TunaMinNanoPayFee, + ReverseNanoPayFeeRatio: c.config.TunaNanoPayFeeRatio, ReverseServiceName: c.config.TunaServiceName, ReverseSubscriptionPrefix: c.config.TunaSubscriptionPrefix, ReverseIPFilter: *c.config.TunaIPFilter, diff --git a/config.go b/config.go index 82e7d0f..23400b5 100644 --- a/config.go +++ b/config.go @@ -13,6 +13,8 @@ type Config struct { TunaDialTimeout int // in millisecond TunaMaxPrice string TunaNanoPayFee string + TunaMinNanoPayFee string + TunaNanoPayFeeRatio float64 TunaServiceName string TunaSubscriptionPrefix string TunaIPFilter *geo.IPFilter @@ -28,7 +30,9 @@ var defaultConfig = Config{ NumTunaListeners: 4, TunaDialTimeout: 10000, TunaMaxPrice: "0", - TunaNanoPayFee: "0", + TunaNanoPayFee: "", + TunaMinNanoPayFee: "0", + TunaNanoPayFeeRatio: 0.1, TunaServiceName: tuna.DefaultReverseServiceName, TunaSubscriptionPrefix: tuna.DefaultSubscriptionPrefix, TunaIPFilter: nil,