diff --git a/Sources/NIOSOCKS/Channel Handlers/SOCKSClientHandler.swift b/Sources/NIOSOCKS/Channel Handlers/SOCKSClientHandler.swift index bcfa71e..7cdf9f0 100644 --- a/Sources/NIOSOCKS/Channel Handlers/SOCKSClientHandler.swift +++ b/Sources/NIOSOCKS/Channel Handlers/SOCKSClientHandler.swift @@ -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() diff --git a/Sources/NIOSOCKS/Messages/ClientRequest.swift b/Sources/NIOSOCKS/Messages/ClientRequest.swift index 56334cd..ecf2c87 100644 --- a/Sources/NIOSOCKS/Messages/ClientRequest.swift +++ b/Sources/NIOSOCKS/Messages/ClientRequest.swift @@ -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) }