mirror of
https://github.com/amnezia-vpn/amneziawg-go.git
synced 2026-05-17 00:05:50 +03:00
* feat: ranged H1-H4 * feat: S3, S4 support * chore: updated awg-tools version --------- Co-authored-by: Yaroslav Gurov <ygurov@proton.me>
37 lines
681 B
Go
37 lines
681 B
Go
package awg
|
|
|
|
import (
|
|
"github.com/tevino/abool"
|
|
"go.uber.org/atomic"
|
|
)
|
|
|
|
// TODO: atomic?/ and better way to use this
|
|
var PacketCounter *atomic.Uint64 = atomic.NewUint64(0)
|
|
|
|
// TODO
|
|
var WaitResponse = struct {
|
|
Channel chan struct{}
|
|
ShouldWait *abool.AtomicBool
|
|
}{
|
|
make(chan struct{}, 1),
|
|
abool.New(),
|
|
}
|
|
|
|
type SpecialHandshakeHandler struct {
|
|
SpecialJunk TagJunkPacketGenerators
|
|
|
|
IsSet bool
|
|
}
|
|
|
|
func (handler *SpecialHandshakeHandler) Validate() error {
|
|
return handler.SpecialJunk.Validate()
|
|
}
|
|
|
|
func (handler *SpecialHandshakeHandler) GenerateSpecialJunk() [][]byte {
|
|
if !handler.SpecialJunk.IsDefined() {
|
|
return nil
|
|
}
|
|
|
|
return handler.SpecialJunk.GeneratePackets()
|
|
}
|