-
Notifications
You must be signed in to change notification settings - Fork 0
/
auth_webhook.go
254 lines (197 loc) · 8.39 KB
/
auth_webhook.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
package sora
import (
"encoding/json"
"time"
)
type Role string
const (
RoleSendrecv Role = "sendrecv"
RoleSendonly Role = "sendonly"
RoleRecvonly Role = "recvonly"
)
type SimulcastRid string
const (
SimulcastRid0 SimulcastRid = "r0"
SimulcastRid1 SimulcastRid = "r1"
SimulcastRid2 SimulcastRid = "r2"
)
type SpotlightRid string
const (
SpotlightRidNone SpotlightRid = "none"
SpotlightRid0 SpotlightRid = "r0"
SpotlightRid1 SpotlightRid = "r0"
SpotlightRid2 SpotlightRid = "r0"
)
type AudioCodecType string
const (
AudioCodecTypeOpus AudioCodecType = "OPUS"
AudioCodecTypeMultiopus AudioCodecType = "MULTIOPUS"
AudioCodecTypeLyra AudioCodecType = "LYRA"
)
type VideoCodecType string
const (
VideoCodecTypeVP8 VideoCodecType = "VP8"
VideoCodecTypeVP9 VideoCodecType = "VP9"
VideoCodecTypeAV1 VideoCodecType = "AV1"
VideoCodecTypeH264 VideoCodecType = "H264"
VideoCodecTypeH265 VideoCodecType = "H265"
)
type AudioOpusParams struct {
Channels int8 `json:"channels"`
Maxplaybackrate int32 `json:"maxplaybackrate"`
Minptime int32 `json:"minptime"`
Ptime int32 `json:"ptime"`
Stereo bool `json:"stereo"`
SpropStereo bool `json:"sprop_stereo"`
Useinbandfec bool `json:"useinbandfec"`
Usedtx bool `json:"usedtx"`
}
type AudioLyraParams struct {
Version string `json:"version"`
Bitrate int32 `json:"bitrate"`
}
type VideoVP9Params struct {
ProfileID int8 `json:"profile_id"`
}
type VideoAV1Params struct {
Profile int8 `json:"profile"`
}
type VideoH264Params struct {
ProfileLevelID string `json:"profile_level_id"`
}
type ForwardingFilterRuleField string
const (
ForwardingFilterRuleFieldConnectionID ForwardingFilterRuleField = "connection_id"
ForwardingFilterRuleFieldClientID ForwardingFilterRuleField = "client_id"
ForwardingFilterRuleFieldKind ForwardingFilterRuleField = "kind"
)
type ForwardingFilterRuleOperator string
const (
ForwardingFilterRuleOperatorIsIn ForwardingFilterRuleOperator = "is_in"
ForwardingFilterRuleOperatorIsNotIn ForwardingFilterRuleOperator = "is_not_in"
)
type ForwardingFilterRule struct {
Field ForwardingFilterRuleField `json:"field"`
Operator ForwardingFilterRuleOperator `json:"operator"`
Values []string `json:"values"`
}
type ForwardingFilterAction string
const (
ForwardingFilterActionBlock ForwardingFilterAction = "block"
ForwardingFilterActionAllow ForwardingFilterAction = "allow"
)
type ForwardingFilter struct {
Action ForwardingFilterAction `json:"action"`
Rules [][]ForwardingFilterRule `json:"rules"`
}
type SimulcastEncoding struct {
Rid string `json:"rid"`
Active bool `json:"active,omitempty"`
ScaleResolutionDownBy float64 `json:"scaleResolutionDownBy,omitempty"`
MaxBitrate float64 `json:"maxBitrate,omitempty"`
MaxFramerate float64 `json:"maxFramerate,omitempty"`
AdaptivePtime bool `json:"adaptivePtime,omitempty"`
ScalabilityMode string `json:"scalabilityMode,omitempty"`
}
type DataChannelParams struct {
Label string `json:"label,omitempty"`
Direction string `json:"direction,omitempty"`
Compress bool `json:"compress"`
Ordered bool `json:"ordered"`
MaxRetransmit int32 `json:"max_retransmit,omitempty"`
MaxPacketLifeTime int32 `json:"max_packet_life_time,omitempty"`
}
type AuthWebhookRequest struct {
Timestamp time.Time `json:"timestamp"`
ID string `json:"id"`
Version string `json:"version"`
Label string `json:"label"`
NodeName string `json:"node_name"`
Role Role `json:"role"`
ChannelID string `json:"channel_id"`
ClientID *string `json:"client_id"`
BundleID *string `json:"bundle_id"`
ConnectionID string `json:"connection_id"`
Multistream bool `json:"multistream"`
Simulcast bool `json:"simulcast"`
SimulcastRid *string `json:"simulcast_rid"`
Spotlight bool `json:"spotlight"`
SpotlightFocusRid *SpotlightRid `json:"spotlight_focus_rid"`
SpotlightUnfocusRid *SpotlightRid `json:"spotlight_unfocus_rid"`
Audio bool `json:"audio"`
AudioCodecType *AudioCodecType `json:"audio_codec_type"`
AudioBitRate *int32 `json:"audio_bit_rate"`
Video bool `json:"video"`
VideoCodecType *VideoCodecType `json:"video_codec_type"`
VideoBitRate *int32 `json:"video_bit_rate"`
VideoVP9Params *VideoVP9Params `json:"video_vp9_params"`
VideoAV1Params *VideoAV1Params `json:"video_av1_params"`
VideoH264Params *VideoH264Params `json:"video_h264_params"`
DataChannelSignaling bool `json:"data_channel_signaling"`
IgnoreDisconnectWebSocket bool `json:"ignore_disconnect_websocket"`
DataChannels *[]DataChannelParams `json:"data_channels"`
ForwardingFilter *ForwardingFilter `json:"forwarding_filter"`
AuthMetadata *json.RawMessage `json:"auth_metadata"`
Metadata *json.RawMessage `json:"metadata"`
WHIP *bool `json:"whip"`
SoraClient SoraClient `json:"sora_client"`
ChannelConnections int32 `json:"channel_connections"`
ChannelSendrecvConnections int32 `json:"channel_sendrecv_connections"`
ChannelSendonlyConnections int32 `json:"channel_sendonly_connections"`
ChannelRecvonlyConnections int32 `json:"channel_recvonly_connections"`
E2EE bool `json:"e2ee"`
}
type SoraClient struct {
Type *string `json:"type"`
Raw *string `json:"raw"`
Version *string `json:"version"`
CommitShort *string `json:"commit_short"`
Environment *string `json:"environment"`
Libwebrtc *string `json:"libwebrtc"`
}
type AuthWebhookSuccessResponse struct {
Allowed bool `json:"allowed"`
ClientID string `json:"client_id,omitempty"`
BundleID string `json:"bundle_id,omitempty"`
Simulcast bool `json:"simulcast,omitempty"`
SimulcastRid string `json:"simulcast_rid,omitempty"`
SimulcastEncodings []SimulcastEncoding `json:"simulcast_encodings,omitempty"`
Spotlight bool `json:"spotlight,omitempty"`
SpotlightNumber int32 `json:"spotlight_number,omitempty"`
SpotlightFocusRid string `json:"spotlight_focus_rid,omitempty"`
SpotlightUnfocusRid string `json:"spotlight_unfocus_rid,omitempty"`
SpotlightEncodings []SimulcastEncoding `json:"spotlight_encodings,omitempty"`
Audio bool `json:"audio,omitempty"`
AudioCodecType AudioCodecType `json:"audio_codec_type,omitempty"`
AudioBitRate int32 `json:"audio_bit_rate,omitempty"`
AudioLyraParams AudioLyraParams `json:"audio_lyra_params,omitempty"`
AudioOpusParams AudioOpusParams `json:"audio_opus_params,omitempty"`
Video bool `json:"video,omitempty"`
VideoCodecType VideoCodecType `json:"video_codec_type,omitempty"`
VideoBitRate int32 `json:"video_bit_rate,omitempty"`
VideoVP9Params VideoVP9Params `json:"video_vp9_params,omitempty"`
VideoAV1Params VideoAV1Params `json:"video_av1_params,omitempty"`
VideoH264Params VideoH264Params `json:"video_h264_params,omitempty"`
DataChannelSignaling bool `json:"data_channel_signaling,omitempty"`
IgnoreDisconnectWebSocket bool `json:"ignore_disconnect_websocket,omitempty"`
DataChannels []DataChannelParams `json:"data_channels,omitempty"`
SignalingNotify bool `json:"signaling_notify,omitempty"`
SignalingNotifyMetadata json.RawMessage `json:"signaling_notify_metadata,omitempty"`
SignalingNotifyMetadataExt json.RawMessage `json:"signaling_notify_metadata_ext,omitempty"`
IPv4Address string `json:"ipv4_address,omitempty"`
IPv6Address string `json:"ipv6_address,omitempty"`
TurnFqdn string `json:"turn_fqdn,omitempty"`
TurnTlsFqdn string `json:"turn_tls_fqdn,omitempty"`
TurnTcpOnly bool `json:"turn_tcp_only,omitempty"`
TurnTlsOnly bool `json:"turn_tls_only,omitempty"`
// Sora 2024.1.0 にて廃止予定です
H264ProfileLevelID string `json:"h264_profile_level_id,omitempty"`
UserAgent bool `json:"user_agent,omitempty"`
AudioStreamingLanguageCode string `json:"audio_streaming_language_code"`
Metadata json.RawMessage `json:"metadata,omitempty"`
EventMetadata json.RawMessage `json:"event_metadata,omitempty"`
}
type AuthWebhookRejectResponse struct {
Allowed bool `json:"allowed"`
Reason string `json:"reason"`
}