27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
-
+
|
@implementation OFTCPSocketSOCKS5Connector
- (instancetype)initWithSocket: (OFTCPSocket *)sock
host: (OFString *)host
port: (uint16_t)port
delegate: (id <OFTCPSocketDelegate>)delegate
#ifdef OF_HAVE_BLOCKS
block: (of_tcp_socket_async_connect_block_t)block
block: (OFTCPSocketAsyncConnectBlock)block
#endif
{
self = [super init];
@try {
_socket = [sock retain];
_host = [host copy];
|
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
|
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
|
-
+
|
}
- (bool)stream: (OFStream *)sock
didReadIntoBuffer: (void *)buffer
length: (size_t)length
exception: (id)exception
{
of_run_loop_mode_t runLoopMode;
OFRunLoopMode runLoopMode;
unsigned char *SOCKSVersion;
uint8_t hostLength;
unsigned char port[2];
unsigned char *response, *addressLength;
if (exception != nil) {
_exception = [exception retain];
|
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
|
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
|
-
+
|
}
- (OFData *)stream: (OFStream *)sock
didWriteData: (OFData *)data
bytesWritten: (size_t)bytesWritten
exception: (id)exception
{
of_run_loop_mode_t runLoopMode;
OFRunLoopMode runLoopMode;
if (exception != nil) {
_exception = [exception retain];
[self didConnect];
return nil;
}
|