mirror of
https://github.com/apple/swift-nio
synced 2026-11-26 04:57:49 +00:00
* Add bootstrap APIs for vsock sockets Signed-off-by: Si Beaumont <beaumont@apple.com> Co-authored-by: Cory Benfield <lukasa@apple.com>
41 lines
1.3 KiB
Swift
41 lines
1.3 KiB
Swift
//===----------------------------------------------------------------------===//
|
|
//
|
|
// This source file is part of the SwiftNIO open source project
|
|
//
|
|
// Copyright (c) 2023 Apple Inc. and the SwiftNIO project authors
|
|
// Licensed under Apache License v2.0
|
|
//
|
|
// See LICENSE.txt for license information
|
|
// See CONTRIBUTORS.txt for the list of SwiftNIO project authors
|
|
//
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
import NIOCore
|
|
|
|
public enum VsockChannelEvents {
|
|
/// Fired as an outbound event when NIO would like to ask itself to bind the socket.
|
|
///
|
|
/// This flow for connect is required because we cannot extend `enum SocketAddress` without
|
|
/// breaking public API.
|
|
public struct BindToAddress: Hashable, Sendable {
|
|
public var address: VsockAddress
|
|
|
|
public init(_ address: VsockAddress) {
|
|
self.address = address
|
|
}
|
|
}
|
|
|
|
/// Fired as an outbound event when NIO would like to ask itself to connect the socket.
|
|
///
|
|
/// This flow for connect is required because we cannot extend `enum SocketAddress` without
|
|
/// breaking public API.
|
|
public struct ConnectToAddress: Hashable, Sendable {
|
|
public var address: VsockAddress
|
|
|
|
public init(_ address: VsockAddress) {
|
|
self.address = address
|
|
}
|
|
}
|
|
}
|