introduce an absolute key phase, use it for key updates

This commit is contained in:
Marten Seemann
2019-06-29 15:38:21 +07:00
parent 5a9c593463
commit a2a4a216de
3 changed files with 20 additions and 13 deletions

View File

@@ -1,5 +1,12 @@
package protocol
// KeyPhase is the key phase
type KeyPhase uint64
func (p KeyPhase) Bit() KeyPhaseBit {
return p%2 == 1
}
// KeyPhaseBit is the key phase bit
type KeyPhaseBit bool
@@ -16,7 +23,3 @@ func (p KeyPhaseBit) String() string {
}
return "1"
}
func (p KeyPhaseBit) Next() KeyPhaseBit {
return !p
}