This commit is contained in:
David Evans 2021-06-07 15:08:28 +01:00
parent f433f5e904
commit 80eeb955e3
2 changed files with 4 additions and 4 deletions

View File

@ -36,7 +36,7 @@ public class SOCKSClientHandler: ChannelDuplexHandler {
switch targetAddress {
case .address(.unixDomainSocket):
preconditionFailure("UNIX domain sockets are not supported.")
case .domain(_, port: _), .address(.v4), .address(.v6):
case .domain, .address(.v4), .address(.v6):
break
}
@ -81,7 +81,7 @@ public class SOCKSClientHandler: ChannelDuplexHandler {
context.write(data, promise: nil)
}
public func writeBufferedData(context: ChannelHandlerContext) {
func writeBufferedData(context: ChannelHandlerContext) {
while let (data, promise) = self.bufferedWrites.first {
context.write(data, promise: promise)
self.bufferedWrites.removeFirst()

View File

@ -92,7 +92,7 @@ public enum AddressType: Hashable {
case .address(.unixDomainSocket):
fatalError("Unsupported")
case .domain(let domain, port: _):
return domain.count + 1
return domain.utf8.count + 1
}
}
}
@ -174,7 +174,7 @@ extension ByteBuffer {
fatalError("UNIX domain sockets are not supported")
case .domain(let domain, port: let port):
return self.writeInteger(UInt8(3))
+ self.writeInteger(UInt8(domain.count))
+ self.writeInteger(UInt8(domain.utf8.count))
+ self.writeString(domain)
+ self.writeInteger(port)
}