实现节点自动切换到备用IP

This commit is contained in:
GoEdgeLab
2021-09-13 10:51:09 +08:00
parent 603ca06601
commit a09a3af84b
4 changed files with 33 additions and 11 deletions

View File

@@ -42,6 +42,7 @@ type NodeIPAddress struct {
IsOn bool `protobuf:"varint,9,opt,name=isOn,proto3" json:"isOn,omitempty"`
IsUp bool `protobuf:"varint,10,opt,name=isUp,proto3" json:"isUp,omitempty"`
Role string `protobuf:"bytes,12,opt,name=role,proto3" json:"role,omitempty"`
BackupIP string `protobuf:"bytes,13,opt,name=backupIP,proto3" json:"backupIP,omitempty"`
}
func (x *NodeIPAddress) Reset() {
@@ -153,12 +154,19 @@ func (x *NodeIPAddress) GetRole() string {
return ""
}
func (x *NodeIPAddress) GetBackupIP() string {
if x != nil {
return x.BackupIP
}
return ""
}
var File_models_model_node_ip_address_proto protoreflect.FileDescriptor
var file_models_model_node_ip_address_proto_rawDesc = []byte{
0x0a, 0x22, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x6e,
0x6f, 0x64, 0x65, 0x5f, 0x69, 0x70, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x2e, 0x70,
0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x22, 0x83, 0x02, 0x0a, 0x0d, 0x4e, 0x6f, 0x64,
0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x22, 0x9f, 0x02, 0x0a, 0x0d, 0x4e, 0x6f, 0x64,
0x65, 0x49, 0x50, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64,
0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x6e, 0x6f,
0x64, 0x65, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x6e, 0x6f, 0x64, 0x65,
@@ -174,8 +182,10 @@ var file_models_model_node_ip_address_proto_rawDesc = []byte{
0x73, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x69, 0x73, 0x4f, 0x6e, 0x18, 0x09, 0x20, 0x01, 0x28, 0x08,
0x52, 0x04, 0x69, 0x73, 0x4f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x69, 0x73, 0x55, 0x70, 0x18, 0x0a,
0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x69, 0x73, 0x55, 0x70, 0x12, 0x12, 0x0a, 0x04, 0x72, 0x6f,
0x6c, 0x65, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x72, 0x6f, 0x6c, 0x65, 0x42, 0x06,
0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x6c, 0x65, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x72, 0x6f, 0x6c, 0x65, 0x12, 0x1a,
0x0a, 0x08, 0x62, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x49, 0x50, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x09,
0x52, 0x08, 0x62, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x49, 0x50, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f,
0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (