refactor Machine to run gRPC server to init cluster

This commit is contained in:
Pavel Sviderski
2024-09-10 13:44:12 +10:00
parent e9f4ad7083
commit 86d949ae48
2 changed files with 114 additions and 65 deletions
+5 -2
View File
@@ -31,11 +31,14 @@ func (c *Server) Network() (netip.Prefix, error) {
return c.state.State.Network.ToPrefix()
}
func (c *Server) SetNetwork(network netip.Prefix) error {
func (c *Server) SetNetwork(network *pb.IPPrefix) error {
if c.state.State.Network != nil {
return fmt.Errorf("network already set and cannot be changed")
}
c.state.State.Network = pb.NewIPPrefix(network)
if network == nil {
return fmt.Errorf("network not set")
}
c.state.State.Network = network
return nil
}