mirror of
https://github.com/DJSundog/wg-portal.git
synced 2024-11-23 07:03:50 -05:00
wip: many small fixes and improvements...
This commit is contained in:
parent
c9a9c5b393
commit
c5cb22829d
@ -104,6 +104,9 @@ func (s *Server) Setup() error {
|
||||
if err := s.users.InitFromCurrentInterface(); err != nil {
|
||||
return errors.New("unable to initialize user manager")
|
||||
}
|
||||
if err := s.RestoreWireGuardInterface(); err != nil {
|
||||
return errors.New("unable to restore wirguard state")
|
||||
}
|
||||
|
||||
dir := s.getExecutableDirectory()
|
||||
rDir, _ := filepath.Abs(filepath.Dir(os.Args[0]))
|
||||
|
@ -164,3 +164,17 @@ func (s *Server) DeleteUser(user User) error {
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *Server) RestoreWireGuardInterface() error {
|
||||
activeUsers := s.users.GetActiveUsers()
|
||||
|
||||
for i := range activeUsers {
|
||||
if activeUsers[i].Peer == nil {
|
||||
if err := s.wg.AddPeer(activeUsers[i].GetPeerConfig()); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user