fix
This commit is contained in:
parent
610a33eced
commit
c6e79b0e68
@ -3,7 +3,7 @@
|
||||
// swiftlint:disable all
|
||||
//
|
||||
// Generated by the Swift generator plugin for the protocol buffer compiler.
|
||||
// Source: tun_pb.proto
|
||||
// Source: tun.proto
|
||||
//
|
||||
// For information on using the generated types, please see the documentation:
|
||||
// https://github.com/apple/swift-protobuf/
|
||||
@ -20,34 +20,35 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP
|
||||
typealias Version = _2
|
||||
}
|
||||
|
||||
struct NEMessage: Sendable {
|
||||
/// 定义App发送给NE的事件
|
||||
struct AppRequest: Sendable {
|
||||
// SwiftProtobuf.Message conformance is added in an extension below. See the
|
||||
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
|
||||
// methods supported on all messages.
|
||||
|
||||
var message: NEMessage.OneOf_Message? = nil
|
||||
var command: AppRequest.OneOf_Command? = nil
|
||||
|
||||
var exitNodeIpChanged: NEMessage.ExitNodeIpChanged {
|
||||
var changeExitNode: AppRequest.ChangeExitNodeRequest {
|
||||
get {
|
||||
if case .exitNodeIpChanged(let v)? = message {return v}
|
||||
return NEMessage.ExitNodeIpChanged()
|
||||
if case .changeExitNode(let v)? = command {return v}
|
||||
return AppRequest.ChangeExitNodeRequest()
|
||||
}
|
||||
set {message = .exitNodeIpChanged(newValue)}
|
||||
set {command = .changeExitNode(newValue)}
|
||||
}
|
||||
|
||||
var unknownFields = SwiftProtobuf.UnknownStorage()
|
||||
|
||||
enum OneOf_Message: Equatable, Sendable {
|
||||
case exitNodeIpChanged(NEMessage.ExitNodeIpChanged)
|
||||
enum OneOf_Command: Equatable, Sendable {
|
||||
case changeExitNode(AppRequest.ChangeExitNodeRequest)
|
||||
|
||||
}
|
||||
|
||||
/// 网络出口ip改变映射变化, 空字符串表示关闭
|
||||
struct ExitNodeIpChanged: Sendable {
|
||||
struct ChangeExitNodeRequest: Sendable {
|
||||
// SwiftProtobuf.Message conformance is added in an extension below. See the
|
||||
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
|
||||
// methods supported on all messages.
|
||||
|
||||
/// 空字符串表示清除出口节点
|
||||
var ip: String = String()
|
||||
|
||||
var unknownFields = SwiftProtobuf.UnknownStorage()
|
||||
@ -58,7 +59,7 @@ struct NEMessage: Sendable {
|
||||
init() {}
|
||||
}
|
||||
|
||||
struct NEReply: Sendable {
|
||||
struct TunnelResponse: Sendable {
|
||||
// SwiftProtobuf.Message conformance is added in an extension below. See the
|
||||
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
|
||||
// methods supported on all messages.
|
||||
@ -72,12 +73,30 @@ struct NEReply: Sendable {
|
||||
init() {}
|
||||
}
|
||||
|
||||
struct TunnelEvent: Sendable {
|
||||
// SwiftProtobuf.Message conformance is added in an extension below. See the
|
||||
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
|
||||
// methods supported on all messages.
|
||||
|
||||
var id: String = String()
|
||||
|
||||
var timestampMs: UInt64 = 0
|
||||
|
||||
var code: Int32 = 0
|
||||
|
||||
var message: String = String()
|
||||
|
||||
var unknownFields = SwiftProtobuf.UnknownStorage()
|
||||
|
||||
init() {}
|
||||
}
|
||||
|
||||
// MARK: - Code below here is support for the SwiftProtobuf runtime.
|
||||
|
||||
extension NEMessage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
|
||||
static let protoMessageName: String = "NEMessage"
|
||||
extension AppRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
|
||||
static let protoMessageName: String = "AppRequest"
|
||||
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
1: .standard(proto: "exit_node_ip_changed"),
|
||||
1: .standard(proto: "change_exit_node"),
|
||||
]
|
||||
|
||||
mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
|
||||
@ -87,16 +106,16 @@ extension NEMessage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementation
|
||||
// enabled. https://github.com/apple/swift-protobuf/issues/1034
|
||||
switch fieldNumber {
|
||||
case 1: try {
|
||||
var v: NEMessage.ExitNodeIpChanged?
|
||||
var v: AppRequest.ChangeExitNodeRequest?
|
||||
var hadOneofValue = false
|
||||
if let current = self.message {
|
||||
if let current = self.command {
|
||||
hadOneofValue = true
|
||||
if case .exitNodeIpChanged(let m) = current {v = m}
|
||||
if case .changeExitNode(let m) = current {v = m}
|
||||
}
|
||||
try decoder.decodeSingularMessageField(value: &v)
|
||||
if let v = v {
|
||||
if hadOneofValue {try decoder.handleConflictingOneOf()}
|
||||
self.message = .exitNodeIpChanged(v)
|
||||
self.command = .changeExitNode(v)
|
||||
}
|
||||
}()
|
||||
default: break
|
||||
@ -109,21 +128,21 @@ extension NEMessage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementation
|
||||
// allocates stack space for every if/case branch local when no optimizations
|
||||
// are enabled. https://github.com/apple/swift-protobuf/issues/1034 and
|
||||
// https://github.com/apple/swift-protobuf/issues/1182
|
||||
try { if case .exitNodeIpChanged(let v)? = self.message {
|
||||
try { if case .changeExitNode(let v)? = self.command {
|
||||
try visitor.visitSingularMessageField(value: v, fieldNumber: 1)
|
||||
} }()
|
||||
try unknownFields.traverse(visitor: &visitor)
|
||||
}
|
||||
|
||||
static func ==(lhs: NEMessage, rhs: NEMessage) -> Bool {
|
||||
if lhs.message != rhs.message {return false}
|
||||
static func ==(lhs: AppRequest, rhs: AppRequest) -> Bool {
|
||||
if lhs.command != rhs.command {return false}
|
||||
if lhs.unknownFields != rhs.unknownFields {return false}
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
extension NEMessage.ExitNodeIpChanged: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
|
||||
static let protoMessageName: String = NEMessage.protoMessageName + ".ExitNodeIpChanged"
|
||||
extension AppRequest.ChangeExitNodeRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
|
||||
static let protoMessageName: String = AppRequest.protoMessageName + ".ChangeExitNodeRequest"
|
||||
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
1: .same(proto: "ip"),
|
||||
]
|
||||
@ -147,15 +166,15 @@ extension NEMessage.ExitNodeIpChanged: SwiftProtobuf.Message, SwiftProtobuf._Mes
|
||||
try unknownFields.traverse(visitor: &visitor)
|
||||
}
|
||||
|
||||
static func ==(lhs: NEMessage.ExitNodeIpChanged, rhs: NEMessage.ExitNodeIpChanged) -> Bool {
|
||||
static func ==(lhs: AppRequest.ChangeExitNodeRequest, rhs: AppRequest.ChangeExitNodeRequest) -> Bool {
|
||||
if lhs.ip != rhs.ip {return false}
|
||||
if lhs.unknownFields != rhs.unknownFields {return false}
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
extension NEReply: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
|
||||
static let protoMessageName: String = "NEReply"
|
||||
extension TunnelResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
|
||||
static let protoMessageName: String = "TunnelResponse"
|
||||
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
1: .same(proto: "code"),
|
||||
2: .same(proto: "message"),
|
||||
@ -184,7 +203,57 @@ extension NEReply: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBa
|
||||
try unknownFields.traverse(visitor: &visitor)
|
||||
}
|
||||
|
||||
static func ==(lhs: NEReply, rhs: NEReply) -> Bool {
|
||||
static func ==(lhs: TunnelResponse, rhs: TunnelResponse) -> Bool {
|
||||
if lhs.code != rhs.code {return false}
|
||||
if lhs.message != rhs.message {return false}
|
||||
if lhs.unknownFields != rhs.unknownFields {return false}
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
extension TunnelEvent: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
|
||||
static let protoMessageName: String = "TunnelEvent"
|
||||
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
1: .same(proto: "id"),
|
||||
2: .standard(proto: "timestamp_ms"),
|
||||
3: .same(proto: "code"),
|
||||
4: .same(proto: "message"),
|
||||
]
|
||||
|
||||
mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
|
||||
while let fieldNumber = try decoder.nextFieldNumber() {
|
||||
// The use of inline closures is to circumvent an issue where the compiler
|
||||
// allocates stack space for every case branch when no optimizations are
|
||||
// enabled. https://github.com/apple/swift-protobuf/issues/1034
|
||||
switch fieldNumber {
|
||||
case 1: try { try decoder.decodeSingularStringField(value: &self.id) }()
|
||||
case 2: try { try decoder.decodeSingularUInt64Field(value: &self.timestampMs) }()
|
||||
case 3: try { try decoder.decodeSingularInt32Field(value: &self.code) }()
|
||||
case 4: try { try decoder.decodeSingularStringField(value: &self.message) }()
|
||||
default: break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
|
||||
if !self.id.isEmpty {
|
||||
try visitor.visitSingularStringField(value: self.id, fieldNumber: 1)
|
||||
}
|
||||
if self.timestampMs != 0 {
|
||||
try visitor.visitSingularUInt64Field(value: self.timestampMs, fieldNumber: 2)
|
||||
}
|
||||
if self.code != 0 {
|
||||
try visitor.visitSingularInt32Field(value: self.code, fieldNumber: 3)
|
||||
}
|
||||
if !self.message.isEmpty {
|
||||
try visitor.visitSingularStringField(value: self.message, fieldNumber: 4)
|
||||
}
|
||||
try unknownFields.traverse(visitor: &visitor)
|
||||
}
|
||||
|
||||
static func ==(lhs: TunnelEvent, rhs: TunnelEvent) -> Bool {
|
||||
if lhs.id != rhs.id {return false}
|
||||
if lhs.timestampMs != rhs.timestampMs {return false}
|
||||
if lhs.code != rhs.code {return false}
|
||||
if lhs.message != rhs.message {return false}
|
||||
if lhs.unknownFields != rhs.unknownFields {return false}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user