mirror of
https://github.com/RoganDawes/P4wnP1_aloa.git
synced 2025-03-17 13:21:50 +01:00
Moved function for Leasefile name generation to shared lib for web_client
This commit is contained in:
parent
d6d8ce789f
commit
8b790c2bdc
10
ToDo.txt
10
ToDo.txt
@ -51,17 +51,17 @@ LOGGING:
|
||||
|
||||
Events:
|
||||
- remove debug out
|
||||
- proper unregister of event listeners from web app
|
||||
- Done: proper unregister of event listeners from web app
|
||||
|
||||
OTHER:
|
||||
- extend installer to movee HIDScripts to a fixed absolute path
|
||||
- proper error extraction from gRPC calls
|
||||
|
||||
- Done: extend installer to move HIDScripts to a fixed absolute path
|
||||
- Not possible (status isn't working here) proper error extraction from gRPC calls
|
||||
- set date from Browser
|
||||
|
||||
TO FIX:
|
||||
- remove dependencies of CLI client on service package
|
||||
- debug out of HIDScript puts way to much CPU load on journaling daemon (floods logs)
|
||||
- allow gRPC server to abort Running HID scripts on context.Done() -> possible, testing needed
|
||||
- Done: allow gRPC server to abort Running HID scripts on context.Done() -> possible, testing needed
|
||||
- jobs aren't deleted from global job list, unless result is fetched with waitResult. This affects interrupted
|
||||
jobs (f.e. timeout) and jobs run as background job --> cancelled jobs need a way to communicate back to the controller,
|
||||
that they could be deleted (Solution: goroutine listening for context.Done() per job in controller)
|
||||
|
@ -10,7 +10,7 @@ import (
|
||||
//"github.com/mame82/P4wnP1_go/service"
|
||||
"strings"
|
||||
"strconv"
|
||||
"github.com/mame82/P4wnP1_go/common"
|
||||
"github.com/mame82/P4wnP1_go/common_web"
|
||||
)
|
||||
|
||||
//Empty settings used to store cobra flags
|
||||
@ -234,7 +234,7 @@ func createDHCPServerSettings(iface string, ip4 string, mask4 string, disabled b
|
||||
Enabled: !disabled,
|
||||
DhcpServerSettings: &pb.DHCPServerSettings{
|
||||
ListenInterface:iface,
|
||||
LeaseFile: common.NameLeaseFileDHCPSrv(iface),
|
||||
LeaseFile: common_web.NameLeaseFileDHCPSrv(iface),
|
||||
CallbackScript: "",
|
||||
ListenPort: 0, //Disable DNS
|
||||
DoNotBindInterface: false, //only listen on given interface
|
||||
|
@ -32,7 +32,7 @@ func ClientConnectServer(rpcHost string, rpcPort string) (
|
||||
client = pb.NewP4WNP1Client(connection)
|
||||
|
||||
// Contact the server
|
||||
ctx, cancel = context.WithTimeout(context.Background(), time.Second)
|
||||
ctx, cancel = context.WithTimeout(context.Background(), time.Second*3)
|
||||
//defer cancel()
|
||||
|
||||
err = nil
|
||||
|
@ -1,11 +0,0 @@
|
||||
package common
|
||||
|
||||
import "fmt"
|
||||
|
||||
// File holds functions used by CLI client and P4wnP1 systemd service. Not to cross import the whole CLI/service
|
||||
// package, is preferred over placing these functions in a contextual logic place.
|
||||
|
||||
func NameLeaseFileDHCPSrv(nameIface string) (lf string) {
|
||||
return fmt.Sprintf("/tmp/dnsmasq_%s.leases", nameIface)
|
||||
}
|
||||
|
5
common_web/net.go
Normal file
5
common_web/net.go
Normal file
@ -0,0 +1,5 @@
|
||||
package common_web
|
||||
|
||||
func NameLeaseFileDHCPSrv(nameIface string) (lf string) {
|
||||
return "/tmp/dnsmasq_" + nameIface + ".leases"
|
||||
}
|
@ -11,7 +11,7 @@ import (
|
||||
"strconv"
|
||||
"syscall"
|
||||
"strings"
|
||||
"github.com/mame82/P4wnP1_go/common"
|
||||
"github.com/mame82/P4wnP1_go/common_web"
|
||||
)
|
||||
|
||||
/*
|
||||
@ -30,7 +30,7 @@ func pidFileDHCPClient(nameIface string) string {
|
||||
}
|
||||
|
||||
func leaseFileDHCPSrv(s *pb.DHCPServerSettings) (lf string) {
|
||||
return common.NameLeaseFileDHCPSrv(s.ListenInterface) //default lease file
|
||||
return common_web.NameLeaseFileDHCPSrv(s.ListenInterface) //default lease file
|
||||
}
|
||||
|
||||
|
||||
@ -214,7 +214,7 @@ func StopDHCPServer(nameIface string) (err error) {
|
||||
os.Remove(pidFileDHCPSrv(nameIface))
|
||||
|
||||
//Deleting leaseFile
|
||||
os.Remove(common.NameLeaseFileDHCPSrv(nameIface))
|
||||
os.Remove(common_web.NameLeaseFileDHCPSrv(nameIface))
|
||||
return nil
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user