diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2014-12-23 05:20:31 -0800 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2014-12-23 05:20:31 -0800 |
commit | f33719f78de63f9b51d10605e99d72222410e60d (patch) | |
tree | ef668c9187abe3f36042d01d3f12321e799054a3 /packet/fsmstate_string.go | |
parent | cb48c082ed63590c42ff27315e583649027241e1 (diff) |
packet: define FSMState
Then we can use stringer nicely. Now FSMstate shows nicely like:
DEBU[0081] Peer (10.0.0.1) state changed from BGP_FSM_ACTIVE to BGP_FSM_OPENSENT
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Diffstat (limited to 'packet/fsmstate_string.go')
-rw-r--r-- | packet/fsmstate_string.go | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/packet/fsmstate_string.go b/packet/fsmstate_string.go new file mode 100644 index 00000000..26cafe25 --- /dev/null +++ b/packet/fsmstate_string.go @@ -0,0 +1,17 @@ +// generated by stringer -type FSMState constatnt.go; DO NOT EDIT + +package bgp + +import "fmt" + +const _FSMState_name = "BGP_FSM_IDLEBGP_FSM_CONNECTBGP_FSM_ACTIVEBGP_FSM_OPENSENTBGP_FSM_OPENCONFIRMBGP_FSM_ESTABLISHED" + +var _FSMState_index = [...]uint8{0, 12, 27, 41, 57, 76, 95} + +func (i FSMState) String() string { + i -= 1 + if i < 0 || i+1 >= FSMState(len(_FSMState_index)) { + return fmt.Sprintf("FSMState(%d)", i+1) + } + return _FSMState_name[_FSMState_index[i]:_FSMState_index[i+1]] +} |