mirror of
				https://git.coolaj86.com/coolaj86/telebit.js.git
				synced 2025-11-04 02:32:47 +00:00 
			
		
		
		
	move block
This commit is contained in:
		
							parent
							
								
									08051e3401
								
							
						
					
					
						commit
						4578d593d8
					
				
							
								
								
									
										25
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										25
									
								
								README.md
									
									
									
									
									
								
							@ -92,6 +92,17 @@ or decrypt https before passing it to the local http handler.
 | 
				
			|||||||
You could do a little magic like this:
 | 
					You could do a little magic like this:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
 | 
					var Dup = {
 | 
				
			||||||
 | 
					  write: function (chunk, encoding, cb) {
 | 
				
			||||||
 | 
					    this.__my_socket.write(chunk, encoding);
 | 
				
			||||||
 | 
					    cb();
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					, read: function (size) {
 | 
				
			||||||
 | 
					    var x = this.__my_socket.read(size);
 | 
				
			||||||
 | 
					    if (x) { this.push(x); }
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
stunnel.connect({
 | 
					stunnel.connect({
 | 
				
			||||||
  // ...
 | 
					  // ...
 | 
				
			||||||
, net: {
 | 
					, net: {
 | 
				
			||||||
@ -100,20 +111,6 @@ stunnel.connect({
 | 
				
			|||||||
    // info = { data, servername, port, host, remoteAddress: { family, address, port } }
 | 
					    // info = { data, servername, port, host, remoteAddress: { family, address, port } }
 | 
				
			||||||
    // socket = { write, push, end, events: [ 'readable', 'data', 'error', 'end' ] };
 | 
					    // socket = { write, push, end, events: [ 'readable', 'data', 'error', 'end' ] };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    var Dup = {
 | 
					 | 
				
			||||||
      write: function (chunk, encoding, cb) {
 | 
					 | 
				
			||||||
        this.__my_socket.write(chunk, encoding);
 | 
					 | 
				
			||||||
        cb();
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
    , read: function (size) {
 | 
					 | 
				
			||||||
        var x = this.__my_socket.read(size);
 | 
					 | 
				
			||||||
        if (x) {
 | 
					 | 
				
			||||||
          console.log('_read', size);
 | 
					 | 
				
			||||||
          this.push(x);
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
    };
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    var myDuplex = new (require('streams').Duplex);
 | 
					    var myDuplex = new (require('streams').Duplex);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    myDuplex.__my_socket = socket;
 | 
					    myDuplex.__my_socket = socket;
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user