Skip to content

Commit

Permalink
ICEServerInfo の urls の型を [URL] から [String] に変更
Browse files Browse the repository at this point in the history
  • Loading branch information
zztkm committed Aug 6, 2024
1 parent f422d9c commit e5c4c4f
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions Sora/ICEServerInfo.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ public final class ICEServerInfo {
// MARK: プロパティ

/// URL のリスト
public var urls: [URL] = []
///
/// URL 構造体を使うと、IPv6 がパーセントエンコードされてしまい、
/// 接続に失敗してしまうため、String で保持します。
public var urls: [String] = []

/// ユーザー名
public var userName: String?
Expand All @@ -20,7 +23,7 @@ public final class ICEServerInfo {
public var tlsSecurityPolicy: TLSSecurityPolicy = .secure

var nativeValue: RTCIceServer {
RTCIceServer(urlStrings: urls.map { url in url.absoluteString },
RTCIceServer(urlStrings: urls,
username: userName,
credential: credential,
tlsCertPolicy: tlsSecurityPolicy.nativeValue)
Expand All @@ -29,7 +32,7 @@ public final class ICEServerInfo {
// MARK: 初期化

/// 初期化します。
public init(urls: [URL],
public init(urls: [String],
userName: String?,
credential: String?,
tlsSecurityPolicy: TLSSecurityPolicy)
Expand Down Expand Up @@ -60,7 +63,7 @@ extension ICEServerInfo: Codable {

public convenience init(from decoder: Decoder) throws {
let container = try decoder.container(keyedBy: CodingKeys.self)
let urls = try container.decode([URL].self, forKey: .urls)
let urls = try container.decode([String].self, forKey: .urls)
let userName = try container.decodeIfPresent(String.self, forKey: .userName)
let credential = try container.decodeIfPresent(String.self, forKey: .credential)
self.init(urls: urls,
Expand Down

0 comments on commit e5c4c4f

Please sign in to comment.