mirror of
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake.git
synced 2025-10-13 11:11:30 -04:00
Add Snowflake Event API interface
This commit is contained in:
parent
d2f6ea5417
commit
75f770150d
1 changed files with 45 additions and 0 deletions
45
common/event/interface.go
Normal file
45
common/event/interface.go
Normal file
|
@ -0,0 +1,45 @@
|
|||
package event
|
||||
|
||||
import "github.com/pion/webrtc/v3"
|
||||
|
||||
type SnowflakeEvent interface {
|
||||
IsSnowflakeEvent()
|
||||
String() string
|
||||
}
|
||||
|
||||
type EventOnOfferCreated struct {
|
||||
SnowflakeEvent
|
||||
WebRTCLocalDescription *webrtc.SessionDescription
|
||||
Error error
|
||||
}
|
||||
|
||||
type EventOnBrokerRendezvous struct {
|
||||
SnowflakeEvent
|
||||
WebRTCRemoteDescription *webrtc.SessionDescription
|
||||
Error error
|
||||
}
|
||||
|
||||
type EventOnSnowflakeConnected struct {
|
||||
SnowflakeEvent
|
||||
}
|
||||
|
||||
type EventOnSnowflakeConnectionFailed struct {
|
||||
SnowflakeEvent
|
||||
Error error
|
||||
}
|
||||
|
||||
type SnowflakeEventReceiver interface {
|
||||
// OnNewSnowflakeEvent notify receiver about a new event
|
||||
// This method MUST not block
|
||||
OnNewSnowflakeEvent(event SnowflakeEvent)
|
||||
}
|
||||
|
||||
type SnowflakeEventDispatcher interface {
|
||||
SnowflakeEventReceiver
|
||||
// AddSnowflakeEventListener allow receiver(s) to receive event notification
|
||||
// when OnNewSnowflakeEvent is called on the dispatcher.
|
||||
// Every event listener added will be called when an event is received by the dispatcher.
|
||||
// The order each listener is called is undefined.
|
||||
AddSnowflakeEventListener(receiver SnowflakeEventReceiver)
|
||||
RemoveSnowflakeEventListener(receiver SnowflakeEventReceiver)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue