Skip to content

Commit 3313415

Browse files
committed
swift: add public modifiers to methods/types that need to be public
updates tailscale/tailscale#13937 A few of the initializers and related types on the Listener and Connection types were default-internal and must be public.
1 parent 40f559c commit 3313415

5 files changed

+11
-11
lines changed

swift/TailscaleKit/Listener.swift

+3-3
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ public actor Listener {
2020
///
2121
/// @param tailscale A handle to a Tailscale server
2222
/// @param proto The ip protocol to listen for
23-
/// @param address The adderss (ip:port or port) to listen on
23+
/// @param address The address (ip:port or port) to listen on
2424
/// @param logger An optional LogSink
25-
init(tailscale: TailscaleHandle,
25+
public init(tailscale: TailscaleHandle,
2626
proto: NetProtocol,
2727
address: String,
2828
logger: LogSink? = nil) async throws {
@@ -68,7 +68,7 @@ public actor Listener {
6868
/// value of Int32.max ms and supports millisecond precision per poll(2)
6969
/// @throws TailscaleError on failure or timeout
7070
/// @returns An incoming connection from which you can receive() Data
71-
func accept(timeout: TimeInterval = 60) async throws -> IncomingConnection {
71+
public func accept(timeout: TimeInterval = 60) async throws -> IncomingConnection {
7272
if timeout * 1000 > Double(Int32.max) || timeout < 0 {
7373
throw TailscaleError.invalidTimeout
7474
}

swift/TailscaleKit/LogSink.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ public protocol LogSink: Sendable {
1010
/// to this. STDOUT_FILENO or a handle to a writable file.
1111
var logFileHandle: Int32? { get }
1212

13-
/// Called for swfit interal logs.
13+
/// Called for swift internal logs.
1414
func log(_ message: String)
1515
}
1616

swift/TailscaleKit/OutgoingConnection.swift

+5-5
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ public enum ListenterState {
2121
case failed ///< The attempt to start the listener failed
2222
}
2323

24-
typealias TailscaleHandle = Int32
25-
typealias TailscaleConnection = Int32
26-
typealias TailscaleListener = Int32
24+
public typealias TailscaleHandle = Int32
25+
public typealias TailscaleConnection = Int32
26+
public typealias TailscaleListener = Int32
2727

2828
/// Outgoing connections are used to send data to other endpoints
2929
/// on the tailnet.
@@ -49,7 +49,7 @@ public actor OutgoingConnection {
4949
/// @param logger
5050
///
5151
/// @throws TailscaleError on failure
52-
init(tailscale: TailscaleHandle,
52+
public init(tailscale: TailscaleHandle,
5353
to address: String,
5454
proto: NetProtocol,
5555
logger: LogSink) async throws {
@@ -66,7 +66,7 @@ public actor OutgoingConnection {
6666
/// @See tailscale_dial in Tailscale.h
6767
///
6868
/// @throws TailscaleError on failure
69-
func connect() async throws {
69+
public func connect() async throws {
7070
let res = tailscale_dial(tailscale, proto.rawValue, address, &conn)
7171

7272
guard res == 0 else {

swift/TailscaleKit/TailscaleNode.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public actor TailscaleNode {
4545

4646
/// Handle to the underlying Tailscale server. Use this when instantiating
4747
/// new IncomingConnections or OutgoingConnections
48-
let tailscale: TailscaleHandle?
48+
public let tailscale: TailscaleHandle?
4949

5050
private let logger: LogSink?
5151

swift/TailscaleKit/URLSession+Tailscale.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public extension URLSessionConfiguration {
3636
]
3737
}
3838

39-
public static func tailscaleSession(_ node: TailscaleNode) async throws -> URLSessionConfiguration {
39+
static func tailscaleSession(_ node: TailscaleNode) async throws -> URLSessionConfiguration {
4040
let config = URLSessionConfiguration.default
4141
try await config.proxyVia(node)
4242
return config

0 commit comments

Comments
 (0)