Skip to content

Commit

Permalink
ice: add State
Browse files Browse the repository at this point in the history
  • Loading branch information
ernado committed Oct 8, 2018
1 parent 826f2a6 commit 04923cf
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions ice.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,27 @@ import (

// bin is shorthand for BigEndian.
var bin = binary.BigEndian

// State represents the ICE agent state.
//
// As per RFC 8445 Section 6.1.3, the ICE agent has a state determined by the
// state of the checklists. The state is Completed if all checklists are
// Completed, Failed if all checklists are Failed, or Running otherwise.
type State byte

const (
// Running if all checklists are nor completed not failed.
Running State = iota
// Completed if all checklists are completed.
Completed
// Failed if all checklists are failed.
Failed
)

var stateToStr = map[State]string{
Running: "Running",
Completed: "Completed",
Failed: "Failed",
}

func (s State) String() string { return stateToStr[s] }

0 comments on commit 04923cf

Please sign in to comment.