ミラー元
				https://git.coolaj86.com/coolaj86/telebit.js.git
				前回の同期 2025-11-04 10:42:45 +00:00 
			
		
		
		
	cleanup
このコミットが含まれているのは:
		
						コミット
						7a08220838
					
				@ -55,17 +55,6 @@ module.exports.print = function (config) {
 | 
				
			|||||||
module.exports.assign = function (state, tun, cb) {
 | 
					module.exports.assign = function (state, tun, cb) {
 | 
				
			||||||
  var net = state.net || require('net');
 | 
					  var net = state.net || require('net');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (!tun.name && !tun.serviceport) {
 | 
					 | 
				
			||||||
    console.log('tun:\n',tun);
 | 
					 | 
				
			||||||
    //console.warn(tun.data.toString());
 | 
					 | 
				
			||||||
    cb(new Error("No routing information for ':tun_id'. Missing both 'name' and 'serviceport'."));
 | 
					 | 
				
			||||||
    return;
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  if (!state.config.servernames) {
 | 
					 | 
				
			||||||
    state.config.servernames = {};
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  var handlers = {};
 | 
					  var handlers = {};
 | 
				
			||||||
  handlers.http = function (socket) {
 | 
					  handlers.http = function (socket) {
 | 
				
			||||||
    if (!state.greenlock) {
 | 
					    if (!state.greenlock) {
 | 
				
			||||||
@ -109,13 +98,6 @@ module.exports.assign = function (state, tun, cb) {
 | 
				
			|||||||
    return conn;
 | 
					    return conn;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if ('http' === tun.service || 'https' === tun.service) {
 | 
					 | 
				
			||||||
    if (!tun.name) {
 | 
					 | 
				
			||||||
      cb(new Error("No routing information for ':tun_id'. Service '" + tun.service + "' is missing 'name'."));
 | 
					 | 
				
			||||||
      return;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  function redirectHttp(cb) {
 | 
					  function redirectHttp(cb) {
 | 
				
			||||||
    var socketPair = require('socket-pair');
 | 
					    var socketPair = require('socket-pair');
 | 
				
			||||||
    var conn = socketPair.create(function (err, other) {
 | 
					    var conn = socketPair.create(function (err, other) {
 | 
				
			||||||
@ -127,31 +109,6 @@ module.exports.assign = function (state, tun, cb) {
 | 
				
			|||||||
    return conn;
 | 
					    return conn;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  var handled;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  if ('http' === tun.service) {
 | 
					 | 
				
			||||||
    // TODO match *.example.com
 | 
					 | 
				
			||||||
    handled = Object.keys(state.config.servernames).some(function (sn) {
 | 
					 | 
				
			||||||
      if (sn !== tun.name) { return; }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      console.log('Found config match for PLAIN', tun.name);
 | 
					 | 
				
			||||||
      if (!state.config.servernames[sn]) { return; }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      if (false === state.config.servernames[sn].terminate) {
 | 
					 | 
				
			||||||
        cb(new Error("insecure http not supported yet"));
 | 
					 | 
				
			||||||
        return true;
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      console.log('Redirecting HTPTP for', tun.name);
 | 
					 | 
				
			||||||
      redirectHttp(cb);
 | 
					 | 
				
			||||||
      return true;
 | 
					 | 
				
			||||||
    });
 | 
					 | 
				
			||||||
    if (!handled) {
 | 
					 | 
				
			||||||
      redirectHttp(cb);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    return;
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  function defineProps(other, tun) {
 | 
					  function defineProps(other, tun) {
 | 
				
			||||||
    Object.defineProperty(other, 'remoteFamily', {
 | 
					    Object.defineProperty(other, 'remoteFamily', {
 | 
				
			||||||
      enumerable: false,
 | 
					      enumerable: false,
 | 
				
			||||||
@ -233,6 +190,50 @@ module.exports.assign = function (state, tun, cb) {
 | 
				
			|||||||
    return conn;
 | 
					    return conn;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  var handled;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  if (!tun.name && !tun.serviceport) {
 | 
				
			||||||
 | 
					    console.log('tun:\n',tun);
 | 
				
			||||||
 | 
					    //console.warn(tun.data.toString());
 | 
				
			||||||
 | 
					    cb(new Error("No routing information for ':tun_id'. Missing both 'name' and 'serviceport'."));
 | 
				
			||||||
 | 
					    return;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  if (!state.config.servernames) {
 | 
				
			||||||
 | 
					    state.config.servernames = {};
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  if ('http' === tun.service || 'https' === tun.service) {
 | 
				
			||||||
 | 
					    if (!tun.name) {
 | 
				
			||||||
 | 
					      cb(new Error("No routing information for ':tun_id'. Service '" + tun.service + "' is missing 'name'."));
 | 
				
			||||||
 | 
					      return;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  if ('http' === tun.service) {
 | 
				
			||||||
 | 
					    // TODO match *.example.com
 | 
				
			||||||
 | 
					    handled = Object.keys(state.config.servernames).some(function (sn) {
 | 
				
			||||||
 | 
					      if (sn !== tun.name) { return; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      console.log('Found config match for PLAIN', tun.name);
 | 
				
			||||||
 | 
					      if (!state.config.servernames[sn]) { return; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      if (false === state.config.servernames[sn].terminate) {
 | 
				
			||||||
 | 
					        cb(new Error("insecure http not supported yet"));
 | 
				
			||||||
 | 
					        return true;
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      console.log('Redirecting HTPTP for', tun.name);
 | 
				
			||||||
 | 
					      redirectHttp(cb);
 | 
				
			||||||
 | 
					      return true;
 | 
				
			||||||
 | 
					    });
 | 
				
			||||||
 | 
					    if (!handled) {
 | 
				
			||||||
 | 
					      redirectHttp(cb);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    return;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if ('https' === tun.service) {
 | 
					  if ('https' === tun.service) {
 | 
				
			||||||
    // TODO match *.example.com
 | 
					    // TODO match *.example.com
 | 
				
			||||||
    handled = Object.keys(state.config.servernames).some(function (sn) {
 | 
					    handled = Object.keys(state.config.servernames).some(function (sn) {
 | 
				
			||||||
 | 
				
			|||||||
		読み込み中…
	
	
			
			x
			
			
		
	
		新しいイシューから参照
	
	ユーザーをブロックする