-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathentrygroupstate.go
55 lines (44 loc) · 1.6 KB
/
entrygroupstate.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// CGo binding for Avahi
//
// Copyright (C) 2024 and up by Alexander Pevzner ([email protected])
// See LICENSE for license terms and conditions
//
// Avahi Entry Group State
//
//go:build linux || freebsd
package avahi
import "fmt"
// #include <avahi-client/publish.h>
import "C"
// EntryGroupState represents an [EntryGroup] state.
type EntryGroupState int
// EntryGroupState values:
const (
// The group has not yet been committed
EntryGroupStateUncommited EntryGroupState = C.AVAHI_ENTRY_GROUP_UNCOMMITED
// The group is currently being registered
EntryGroupStateRegistering EntryGroupState = C.AVAHI_ENTRY_GROUP_REGISTERING
// The group has been successfully established
EntryGroupStateEstablished EntryGroupState = C.AVAHI_ENTRY_GROUP_ESTABLISHED
// A name collision for one of entries in the group has been detected.
// The entries has been withdrawn.
EntryGroupStateCollision EntryGroupState = C.AVAHI_ENTRY_GROUP_COLLISION
// Some kind of failure has been detected, the entries has been withdrawn.
EntryGroupStateFailure EntryGroupState = C.AVAHI_ENTRY_GROUP_FAILURE
)
// clientStateNames contains names for known client states.
var entryGroupStateNames = map[EntryGroupState]string{
EntryGroupStateUncommited: "uncommitted",
EntryGroupStateRegistering: "registering",
EntryGroupStateEstablished: "established",
EntryGroupStateCollision: "collision",
EntryGroupStateFailure: "failure",
}
// String returns a name of the EntryGroupState.
func (state EntryGroupState) String() string {
n := entryGroupStateNames[state]
if n == "" {
n = fmt.Sprintf("UNKNOWN %d", int(state))
}
return n
}