Paul Stemmet
a44d541cb7
A uint number between 0 and 255, representing the new priority of the associated INSTANCE. In newer versions of the VRRP protocol (v2+) a instance's priority must be 255 to be considered MASTER, but older versions only require the highest current priority to be MASTER. This field is also _optional_ keepalived will only output it for VRRP events, and then only if a setting is enabled in the conf file, 'vrrp_notify_priority_changes'. TYPE INSTANCE STATE PRIORITY ^^^^^^^^
31 lines
498 B
Go
31 lines
498 B
Go
/*
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
*/
|
|
|
|
package prio
|
|
|
|
import (
|
|
"strconv"
|
|
"strings"
|
|
)
|
|
|
|
const (
|
|
NULL Priority = 0
|
|
MASTER Priority = 255
|
|
)
|
|
|
|
func ParsePriority(i string) Priority {
|
|
i = strings.TrimSpace(i)
|
|
|
|
p, err := strconv.ParseUint(i, 10, 8)
|
|
if err != nil {
|
|
return NULL
|
|
}
|
|
|
|
return Priority(p)
|
|
}
|
|
|
|
type Priority uint8
|