Merge pull request 'Shared-Files' (#2) from Shared-Files into main
Reviewed-on: #2
This commit is contained in:
14
Relay.sln
14
Relay.sln
@@ -9,6 +9,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RelayClient", "RelayClient\
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RelayServer", "RelayServer\RelayServer.csproj", "{38995780-E9AA-44D6-B62D-07CCA45E4E4C}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RelayShared", "RelayShared\RelayShared.csproj", "{60B17B0B-9910-426A-9B48-AD9377AC89F7}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@@ -55,6 +57,18 @@ Global
|
||||
{38995780-E9AA-44D6-B62D-07CCA45E4E4C}.Release|x64.Build.0 = Release|Any CPU
|
||||
{38995780-E9AA-44D6-B62D-07CCA45E4E4C}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{38995780-E9AA-44D6-B62D-07CCA45E4E4C}.Release|x86.Build.0 = Release|Any CPU
|
||||
{60B17B0B-9910-426A-9B48-AD9377AC89F7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{60B17B0B-9910-426A-9B48-AD9377AC89F7}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{60B17B0B-9910-426A-9B48-AD9377AC89F7}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{60B17B0B-9910-426A-9B48-AD9377AC89F7}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{60B17B0B-9910-426A-9B48-AD9377AC89F7}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{60B17B0B-9910-426A-9B48-AD9377AC89F7}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{60B17B0B-9910-426A-9B48-AD9377AC89F7}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{60B17B0B-9910-426A-9B48-AD9377AC89F7}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{60B17B0B-9910-426A-9B48-AD9377AC89F7}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{60B17B0B-9910-426A-9B48-AD9377AC89F7}.Release|x64.Build.0 = Release|Any CPU
|
||||
{60B17B0B-9910-426A-9B48-AD9377AC89F7}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{60B17B0B-9910-426A-9B48-AD9377AC89F7}.Release|x86.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
using RelayClient.Crypto;
|
||||
using RelayClient.Models;
|
||||
using WebSocketSharp;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
using System.Text.Json.Serialization.Metadata;
|
||||
using RelayShared.Rtc;
|
||||
|
||||
namespace RelayClient;
|
||||
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
namespace RelayClient.Models;
|
||||
|
||||
public class ChannelItem
|
||||
{
|
||||
public required string ChannelId { get; set; }
|
||||
public required string Name { get; set; }
|
||||
public required DateTime CreatedAt { get; set; }
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
namespace RelayClient.Models;
|
||||
|
||||
public sealed class RtcNotificationMessage
|
||||
{
|
||||
public string? Type { get; set; }
|
||||
public string? ChannelId { get; set; }
|
||||
public string? Username { get; set; }
|
||||
public string? Direction { get; set; }
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
namespace RelayClient.Models;
|
||||
|
||||
public class RtcSignalMessage
|
||||
{
|
||||
public required string Type { get; set; } // rtc_join / rtc_offer / rtc_answer / rtc_ice_candidate / rtc_leave
|
||||
public required string From { get; set; }
|
||||
public required string ChannelId { get; set; }
|
||||
|
||||
public string? Sdp { get; set; }
|
||||
public string? Candidate { get; set; }
|
||||
public string? SdpMid { get; set; }
|
||||
public int? SdpMLineIndex { get; set; }
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
namespace RelayClient.Models;
|
||||
|
||||
public class ServerPublicKeyMessage
|
||||
{
|
||||
public required string Type { get; set; }
|
||||
public required string PublicKey { get; set; }
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
namespace RelayClient.Models;
|
||||
|
||||
public class SocketChannelList
|
||||
{
|
||||
public required string Type { get; set; }
|
||||
public required List<ChannelItem> Channels { get; set; }
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
namespace RelayClient.Models;
|
||||
|
||||
public class SocketEncryptedMessage
|
||||
{
|
||||
public required string Type { get; set; }
|
||||
public required string SenderUsername { get; set; }
|
||||
public string? RecipientUsername { get; set; }
|
||||
public required string ChannelId { get; set; }
|
||||
public required string CipherText { get; set; }
|
||||
public required string Nonce { get; set; }
|
||||
public required string Tag { get; set; }
|
||||
public required string EncryptedKey { get; set; }
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
namespace RelayClient.Models;
|
||||
|
||||
public class SocketRtcSignalMessage
|
||||
{
|
||||
public required string Type { get; set; } // encrypted_rtc_signal
|
||||
public required string SenderUsername { get; set; }
|
||||
public required string ChannelId { get; set; }
|
||||
|
||||
public required string CipherText { get; set; }
|
||||
public required string Nonce { get; set; }
|
||||
public required string Tag { get; set; }
|
||||
public required string EncryptedKey { get; set; }
|
||||
}
|
||||
@@ -50,4 +50,12 @@
|
||||
<PackageReference Include="WebSocketSharp" Version="1.0.3-rc11" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\RelayShared\RelayShared.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Models\" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -25,6 +25,7 @@ window.setChannelId = function(channelId) {
|
||||
currentChannelId = channelId;
|
||||
LogMessage("Channel set to: " + currentChannelId);
|
||||
};
|
||||
|
||||
function LogMessage(msg) {
|
||||
const messageLog = document.getElementById("messageLog");
|
||||
messageLog.value += '\r\n' + msg;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using System.Text.Json;
|
||||
using RelayServer.Models.Rtc;
|
||||
using RelayShared.Rtc;
|
||||
using RelayServer.Services.Rtc;
|
||||
|
||||
namespace RelayServer.Endpoints;
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
namespace RelayServer.Models;
|
||||
|
||||
public class SocketChannelList
|
||||
{
|
||||
public required string Type { get; set; }
|
||||
public required List<SocketChannelInfo> Channels { get; set; }
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
namespace RelayServer.Models;
|
||||
|
||||
public class SocketEncryptedMessage
|
||||
{
|
||||
public required string Type { get; set; }
|
||||
public required string SenderUsername { get; set; }
|
||||
public string? RecipientUsername { get; set; }
|
||||
public required string ChannelId { get; set; }
|
||||
public required string CipherText { get; set; }
|
||||
public required string Nonce { get; set; }
|
||||
public required string Tag { get; set; }
|
||||
public required string EncryptedKey { get; set; }
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
namespace RelayServer.Models;
|
||||
|
||||
public class RtcSignalMessage
|
||||
{
|
||||
public required string Type { get; set; } // rtc_join / rtc_offer / rtc_answer / rtc_ice_candidate / rtc_leave
|
||||
public required string From { get; set; }
|
||||
public required string ChannelId { get; set; }
|
||||
|
||||
public string? Sdp { get; set; }
|
||||
public string? Candidate { get; set; }
|
||||
public string? SdpMid { get; set; }
|
||||
public int? SdpMLineIndex { get; set; }
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
namespace RelayServer.Models;
|
||||
|
||||
public class ServerPublicKeyMessage
|
||||
{
|
||||
public required string Type { get; set; }
|
||||
public required string PublicKey { get; set; }
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
namespace RelayServer.Models;
|
||||
|
||||
public class SocketRtcSignalMessage
|
||||
{
|
||||
public required string Type { get; set; } // encrypted_rtc_signal
|
||||
public required string SenderUsername { get; set; }
|
||||
public required string ChannelId { get; set; }
|
||||
|
||||
public required string CipherText { get; set; }
|
||||
public required string Nonce { get; set; }
|
||||
public required string Tag { get; set; }
|
||||
public required string EncryptedKey { get; set; }
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
using SurrealDb.Net.Models;
|
||||
|
||||
namespace RelayServer.Models.Rtc;
|
||||
|
||||
public sealed class RtcActiveCall : Record
|
||||
{
|
||||
public required string ChannelId { get; set; }
|
||||
public string? OfferUser { get; set; }
|
||||
public RtcSessionDescription? Offer { get; set; }
|
||||
public RtcSessionDescription? Answer { get; set; }
|
||||
public DateTime CreatedAt { get; set; }
|
||||
public DateTime UpdatedAt { get; set; }
|
||||
public bool IsActive { get; set; }
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
using SurrealDb.Net.Models;
|
||||
|
||||
namespace RelayServer.Models.Rtc;
|
||||
|
||||
public class RtcAnswer : Record
|
||||
{
|
||||
public required string ChannelId { get; set; }
|
||||
public required string OfferUser { get; set; }
|
||||
public required string AnswerUser { get; set; }
|
||||
public required string Sdp { get; set; }
|
||||
public DateTime CreatedAt { get; set; }
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
using SurrealDb.Net.Models;
|
||||
|
||||
namespace RelayServer.Models.Rtc;
|
||||
|
||||
public class RtcIceCandidate : Record
|
||||
{
|
||||
public required string ChannelId { get; set; }
|
||||
public required string Username { get; set; }
|
||||
public required string Candidate { get; set; }
|
||||
public string? SdpMid { get; set; }
|
||||
public int? SdpMLineIndex { get; set; }
|
||||
// public required string Direction { get; set; } // "offer" or "answer"
|
||||
public DateTime CreatedAt { get; set; }
|
||||
}
|
||||
|
||||
public class DBIceCandidate
|
||||
{
|
||||
public required string ChannelId { get; set; }
|
||||
public required string Username { get; set; }
|
||||
public required IceCandidate Candidate { get; set; }
|
||||
}
|
||||
|
||||
public class IceCandidate
|
||||
{
|
||||
public required string candidate { get; set; }
|
||||
public required string sdpMid { get; set; }
|
||||
public required int sdpMLineIndex { get; set; }
|
||||
public required string usernameFragment { get; set; }
|
||||
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
namespace RelayServer.Models.Rtc;
|
||||
|
||||
public class RtcJoinRequest
|
||||
{
|
||||
public required string ChannelId { get; set; }
|
||||
public required string Username { get; set; }
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
namespace RelayServer.Models.Rtc;
|
||||
|
||||
public class RtcJoinResponse
|
||||
{
|
||||
public required string ChannelId { get; set; }
|
||||
public bool HasActiveCall { get; set; }
|
||||
public bool IsOfferer { get; set; }
|
||||
public string? OfferUser { get; set; }
|
||||
public string? OfferSdp { get; set; }
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
namespace RelayServer.Models.Rtc;
|
||||
|
||||
public class RtcLeaveRequest
|
||||
{
|
||||
public required string ChannelId { get; set; }
|
||||
public required string Username { get; set; }
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
namespace RelayServer.Models.Rtc;
|
||||
|
||||
public sealed class RtcNotificationMessage
|
||||
{
|
||||
public required string Type { get; set; } // rtc_offer_updated / rtc_answer_updated / rtc_candidate_added
|
||||
public required string ChannelId { get; set; }
|
||||
public string? Username { get; set; }
|
||||
public string? Direction { get; set; }
|
||||
}
|
||||
|
||||
public sealed class RtcIceNotificationMessage
|
||||
{
|
||||
public required string Type { get; set; }
|
||||
public required string ChannelId { get; set; }
|
||||
public string? Username { get; set; }
|
||||
public required IceCandidate Candidate { get; set; }
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
using SurrealDb.Net.Models;
|
||||
|
||||
namespace RelayServer.Models.Rtc;
|
||||
|
||||
public class RtcOffer : Record
|
||||
{
|
||||
public required string ChannelId { get; set; }
|
||||
public required string Username { get; set; }
|
||||
public required RtcSessionDescription SessionDescription { get; set; }
|
||||
// public required string Type { get; set; }
|
||||
// public required string Sdp { get; set; }
|
||||
public DateTime CreatedAt { get; set; }
|
||||
public DateTime UpdatedAt { get; set; }
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
namespace RelayServer.Models.Rtc;
|
||||
|
||||
public sealed class RtcSessionDescription
|
||||
{
|
||||
public required string Type { get; set; }
|
||||
public required string Sdp { get; set; }
|
||||
}
|
||||
@@ -3,6 +3,7 @@ using RelayServer.Services.Chat;
|
||||
using RelayServer.Services.Core;
|
||||
using RelayServer.Services.Data;
|
||||
using RelayServer.Services.Rtc;
|
||||
using RelayShared.Rtc;
|
||||
using WebSocketSharp.Server;
|
||||
|
||||
var surrealService = new SurrealService();
|
||||
|
||||
@@ -13,4 +13,12 @@
|
||||
<PackageReference Include="WebSocketSharp" Version="1.0.3-rc11" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\RelayShared\RelayShared.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Models\Rtc\" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -6,6 +6,7 @@ using RelayServer.Services.Rtc;
|
||||
using WebSocketSharp;
|
||||
using WebSocketSharp.Server;
|
||||
using ErrorEventArgs = WebSocketSharp.ErrorEventArgs;
|
||||
using RelayShared.Rtc;
|
||||
|
||||
namespace RelayServer.Services.Chat;
|
||||
|
||||
@@ -145,7 +146,7 @@ public class ChatSocketBehavior : WebSocketBehavior
|
||||
|
||||
var channels = GetChannelsSync()
|
||||
.OrderBy(c => c.CreatedAt)
|
||||
.Select(c => new SocketChannelInfo
|
||||
.Select(c => new ChannelItem()
|
||||
{
|
||||
ChannelId = GetRecordId(c.Id),
|
||||
Name = c.Name,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using RelayServer.Models.Rtc;
|
||||
using RelayShared.Rtc;
|
||||
using SurrealDb.Net;
|
||||
|
||||
namespace RelayServer.Services.Rtc;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using System.Text.Json;
|
||||
using RelayServer.Models.Rtc;
|
||||
using RelayShared.Rtc;
|
||||
using WebSocketSharp.Server;
|
||||
|
||||
namespace RelayServer.Services.Rtc;
|
||||
|
||||
93
RelayShared/.gitignore
vendored
Normal file
93
RelayShared/.gitignore
vendored
Normal file
@@ -0,0 +1,93 @@
|
||||
############################################
|
||||
# .NET Build
|
||||
############################################
|
||||
|
||||
bin/
|
||||
obj/
|
||||
out/
|
||||
publish/
|
||||
|
||||
############################################
|
||||
# Visual Studio
|
||||
############################################
|
||||
|
||||
.vs/
|
||||
*.user
|
||||
*.suo
|
||||
*.userprefs
|
||||
*.csproj.user
|
||||
*.dbmdl
|
||||
*.cache
|
||||
*.pdb
|
||||
*.opendb
|
||||
|
||||
############################################
|
||||
# Rider / JetBrains
|
||||
############################################
|
||||
|
||||
.idea/
|
||||
*.sln.iml
|
||||
|
||||
############################################
|
||||
# VSCode
|
||||
############################################
|
||||
|
||||
.vscode/
|
||||
|
||||
############################################
|
||||
# NuGet
|
||||
############################################
|
||||
|
||||
*.nupkg
|
||||
*.snupkg
|
||||
packages/
|
||||
.nuget/
|
||||
.nuget/packages/
|
||||
|
||||
############################################
|
||||
# Logs
|
||||
############################################
|
||||
|
||||
*.log
|
||||
logs/
|
||||
|
||||
############################################
|
||||
# OS files
|
||||
############################################
|
||||
|
||||
.DS_Store
|
||||
Thumbs.db
|
||||
|
||||
############################################
|
||||
# Local secrets / environment
|
||||
############################################
|
||||
|
||||
.env
|
||||
.env.*
|
||||
secrets.json
|
||||
appsettings.Development.json
|
||||
|
||||
############################################
|
||||
# E2EE private keys
|
||||
############################################
|
||||
|
||||
keys/*
|
||||
!keys/.gitkeep
|
||||
|
||||
############################################
|
||||
# Local test databases / data folders
|
||||
############################################
|
||||
|
||||
data/
|
||||
*.db
|
||||
*.sqlite
|
||||
*.sqlite3
|
||||
|
||||
############################################
|
||||
# Temporary files
|
||||
############################################
|
||||
|
||||
*.tmp
|
||||
*.temp
|
||||
*.bak
|
||||
*.swp
|
||||
9
RelayShared/Class1.cs
Normal file
9
RelayShared/Class1.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
namespace RelayShared;
|
||||
|
||||
public class Class1
|
||||
{
|
||||
public Class1()
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
13
RelayShared/RelayShared.csproj
Normal file
13
RelayShared/RelayShared.csproj
Normal file
@@ -0,0 +1,13 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net9.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="SurrealDb.Net" Version="0.9.0" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
155
RelayShared/Rtc/RtcModels.cs
Normal file
155
RelayShared/Rtc/RtcModels.cs
Normal file
@@ -0,0 +1,155 @@
|
||||
using SurrealDb.Net.Models;
|
||||
|
||||
namespace RelayShared.Rtc;
|
||||
|
||||
public static class RtcSignalTypes
|
||||
{
|
||||
public const string Offer = "rtc_offer";
|
||||
public const string Answer = "rtc_answer";
|
||||
public const string Candidate = "rtc_candidate";
|
||||
public const string OfferUpdated = "rtc_offer_updated";
|
||||
public const string AnswerUpdated = "rtc_answer_updated";
|
||||
public const string CandidateAdded = "rtc_candidate_added";
|
||||
public const string CallLeft = "rtc_call_left";
|
||||
}
|
||||
|
||||
public sealed class RtcSignalMessage
|
||||
{
|
||||
public string Type { get; set; } = string.Empty;
|
||||
public string From { get; set; } = string.Empty;
|
||||
public string ChannelId { get; set; } = string.Empty;
|
||||
public string? Sdp { get; set; }
|
||||
public string? Candidate { get; set; }
|
||||
public string? SdpMid { get; set; }
|
||||
public int? SdpMLineIndex { get; set; }
|
||||
public bool IsInitiator { get; set; }
|
||||
}
|
||||
|
||||
public sealed class RtcNotificationMessage
|
||||
{
|
||||
public string? Type { get; set; }
|
||||
public string? ChannelId { get; set; }
|
||||
public string? Username { get; set; }
|
||||
public string? Direction { get; set; }
|
||||
}
|
||||
|
||||
public sealed class ServerPublicKeyMessage
|
||||
{
|
||||
public string Type { get; set; } = string.Empty;
|
||||
public string PublicKey { get; set; } = string.Empty;
|
||||
}
|
||||
|
||||
public sealed class SocketRtcSignalMessage
|
||||
{
|
||||
public string Type { get; set; } = string.Empty;
|
||||
public string SenderUsername { get; set; } = string.Empty;
|
||||
public string ChannelId { get; set; } = string.Empty;
|
||||
public string CipherText { get; set; } = string.Empty;
|
||||
public string Nonce { get; set; } = string.Empty;
|
||||
public string Tag { get; set; } = string.Empty;
|
||||
public string EncryptedKey { get; set; } = string.Empty;
|
||||
}
|
||||
|
||||
public sealed class SocketEncryptedMessage
|
||||
{
|
||||
public string Type { get; set; } = string.Empty;
|
||||
public string SenderUsername { get; set; } = string.Empty;
|
||||
public string RecipientUsername { get; set; } = string.Empty;
|
||||
public string ChannelId { get; set; } = string.Empty;
|
||||
public string CipherText { get; set; } = string.Empty;
|
||||
public string Nonce { get; set; } = string.Empty;
|
||||
public string Tag { get; set; } = string.Empty;
|
||||
public string EncryptedKey { get; set; } = string.Empty;
|
||||
}
|
||||
|
||||
public sealed class ChannelItem
|
||||
{
|
||||
public string ChannelId { get; set; } = string.Empty;
|
||||
public string Name { get; set; } = string.Empty;
|
||||
public DateTime CreatedAt { get; set; }
|
||||
}
|
||||
|
||||
public sealed class SocketChannelList
|
||||
{
|
||||
public string Type { get; set; } = string.Empty;
|
||||
public List<ChannelItem> Channels { get; set; } = [];
|
||||
}
|
||||
|
||||
public sealed class RtcJoinRequest
|
||||
{
|
||||
public string ChannelId { get; set; } = string.Empty;
|
||||
public string Username { get; set; } = string.Empty;
|
||||
}
|
||||
|
||||
public sealed class RtcJoinResponse
|
||||
{
|
||||
public string ChannelId { get; set; } = string.Empty;
|
||||
public bool HasActiveCall { get; set; }
|
||||
public bool IsOfferer { get; set; }
|
||||
public string? OfferUser { get; set; }
|
||||
public RtcSessionDescription? OfferSdp { get; set; }
|
||||
}
|
||||
|
||||
public sealed class RtcLeaveRequest
|
||||
{
|
||||
public string ChannelId { get; set; } = string.Empty;
|
||||
public string Username { get; set; } = string.Empty;
|
||||
}
|
||||
|
||||
public sealed class RtcSessionDescription
|
||||
{
|
||||
public string Type { get; set; } = string.Empty;
|
||||
public string Sdp { get; set; } = string.Empty;
|
||||
}
|
||||
|
||||
public sealed class RtcOffer
|
||||
{
|
||||
public string ChannelId { get; set; } = string.Empty;
|
||||
public string Username { get; set; } = string.Empty;
|
||||
public RtcSessionDescription SessionDescription { get; set; } = new();
|
||||
}
|
||||
|
||||
public sealed class RtcAnswer
|
||||
{
|
||||
public string ChannelId { get; set; } = string.Empty;
|
||||
public string Username { get; set; } = string.Empty;
|
||||
public RtcSessionDescription SessionDescription { get; set; } = new();
|
||||
}
|
||||
|
||||
public class RtcIceCandidate : Record
|
||||
{
|
||||
public required string ChannelId { get; set; }
|
||||
public required string Username { get; set; }
|
||||
public required string Candidate { get; set; }
|
||||
public string? SdpMid { get; set; }
|
||||
public int? SdpMLineIndex { get; set; }
|
||||
// public required string Direction { get; set; } // "offer" or "answer"
|
||||
public DateTime CreatedAt { get; set; }
|
||||
}
|
||||
|
||||
public class DBIceCandidate
|
||||
{
|
||||
public required string ChannelId { get; set; }
|
||||
public required string Username { get; set; }
|
||||
public required IceCandidate Candidate { get; set; }
|
||||
}
|
||||
|
||||
public class IceCandidate
|
||||
{
|
||||
public required string candidate { get; set; }
|
||||
public required string sdpMid { get; set; }
|
||||
public required int sdpMLineIndex { get; set; }
|
||||
public required string usernameFragment { get; set; }
|
||||
|
||||
}
|
||||
|
||||
public sealed class RtcActiveCall : Record
|
||||
{
|
||||
public string ChannelId { get; set; } = string.Empty;
|
||||
public string? OfferUser { get; set; }
|
||||
public RtcSessionDescription? Offer { get; set; }
|
||||
public RtcSessionDescription? Answer { get; set; }
|
||||
public DateTime CreatedAt { get; set; }
|
||||
public DateTime UpdatedAt { get; set; }
|
||||
public bool IsActive { get; set; }
|
||||
}
|
||||
6
RelayShared/Rtc/RtcServices.cs
Normal file
6
RelayShared/Rtc/RtcServices.cs
Normal file
@@ -0,0 +1,6 @@
|
||||
namespace RelayShared.Rtc;
|
||||
|
||||
public class RtcServices
|
||||
{
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user