fix naming
This commit is contained in:
parent
b446b5969f
commit
1a2ce765f9
10
kvas2.go
10
kvas2.go
@ -24,8 +24,8 @@ var (
|
|||||||
|
|
||||||
type Config struct {
|
type Config struct {
|
||||||
MinimalTTL time.Duration
|
MinimalTTL time.Duration
|
||||||
ChainPostfix string
|
ChainPrefix string
|
||||||
IpSetPostfix string
|
IpSetPrefix string
|
||||||
TargetDNSServerAddress string
|
TargetDNSServerAddress string
|
||||||
ListenPort uint16
|
ListenPort uint16
|
||||||
UseSoftwareRouting bool
|
UseSoftwareRouting bool
|
||||||
@ -90,7 +90,7 @@ func (a *App) listen(ctx context.Context) (err error) {
|
|||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
a.dnsOverrider4 = a.NetfilterHelper4.PortRemap(fmt.Sprintf("%sDNSOR", a.Config.ChainPostfix), 53, a.Config.ListenPort)
|
a.dnsOverrider4 = a.NetfilterHelper4.PortRemap(fmt.Sprintf("%sDNSOR", a.Config.ChainPrefix), 53, a.Config.ListenPort)
|
||||||
err = a.dnsOverrider4.Enable()
|
err = a.dnsOverrider4.Enable()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to override DNS: %v", err)
|
return fmt.Errorf("failed to override DNS: %v", err)
|
||||||
@ -228,7 +228,7 @@ func (a *App) AddGroup(group *models.Group) error {
|
|||||||
return ErrGroupIDConflict
|
return ErrGroupIDConflict
|
||||||
}
|
}
|
||||||
|
|
||||||
ipsetName := fmt.Sprintf("%s%d", a.Config.IpSetPostfix, group.ID)
|
ipsetName := fmt.Sprintf("%s%d", a.Config.IpSetPrefix, group.ID)
|
||||||
ipset, err := a.NetfilterHelper4.IPSet(ipsetName)
|
ipset, err := a.NetfilterHelper4.IPSet(ipsetName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to initialize ipset: %w", err)
|
return fmt.Errorf("failed to initialize ipset: %w", err)
|
||||||
@ -238,7 +238,7 @@ func (a *App) AddGroup(group *models.Group) error {
|
|||||||
Group: group,
|
Group: group,
|
||||||
iptables: a.NetfilterHelper4.IPTables,
|
iptables: a.NetfilterHelper4.IPTables,
|
||||||
ipset: ipset,
|
ipset: ipset,
|
||||||
ifaceToIPSet: a.NetfilterHelper4.IfaceToIPSet(fmt.Sprintf("%sR_%d", a.Config.ChainPostfix, group.ID), group.Interface, ipsetName, false),
|
ifaceToIPSet: a.NetfilterHelper4.IfaceToIPSet(fmt.Sprintf("%sR_%d", a.Config.ChainPrefix, group.ID), group.Interface, ipsetName, false),
|
||||||
}
|
}
|
||||||
a.Groups[group.ID] = grp
|
a.Groups[group.ID] = grp
|
||||||
return a.SyncGroup(grp)
|
return a.SyncGroup(grp)
|
||||||
|
4
main.go
4
main.go
@ -16,8 +16,8 @@ func main() {
|
|||||||
|
|
||||||
app, err := New(Config{
|
app, err := New(Config{
|
||||||
MinimalTTL: time.Hour,
|
MinimalTTL: time.Hour,
|
||||||
ChainPostfix: "KVAS2_",
|
ChainPrefix: "KVAS2_",
|
||||||
IpSetPostfix: "kvas2_",
|
IpSetPrefix: "kvas2_",
|
||||||
TargetDNSServerAddress: "127.0.0.1:53",
|
TargetDNSServerAddress: "127.0.0.1:53",
|
||||||
ListenPort: 7548,
|
ListenPort: 7548,
|
||||||
})
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user