mirror of
				https://github.com/v2board/v2board.git
				synced 2025-11-01 01:41:47 +08:00 
			
		
		
		
	update: Support TCP-HTTP sub rules
This commit is contained in:
		| @@ -129,6 +129,11 @@ class Clash | |||||||
|                     $array['servername'] = $tlsSettings['serverName']; |                     $array['servername'] = $tlsSettings['serverName']; | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|  |         if ($server['network'] === 'tcp') { | ||||||
|  |             $tcpSettings = $server['networkSettings']; | ||||||
|  |             if (isset($tcpSettings['header']['type'])) $array['network'] = $tcpSettings['header']['type']; | ||||||
|  |             if (isset($tcpSettings['header']['request']['path'][0])) $array['http-opts']['path'] = $tcpSettings['header']['request']['path'][0]; | ||||||
|  |         } | ||||||
|         if ($server['network'] === 'ws') { |         if ($server['network'] === 'ws') { | ||||||
|             $array['network'] = 'ws'; |             $array['network'] = 'ws'; | ||||||
|             if ($server['networkSettings']) { |             if ($server['networkSettings']) { | ||||||
|   | |||||||
| @@ -128,6 +128,11 @@ class ClashMeta | |||||||
|                     $array['servername'] = $tlsSettings['serverName']; |                     $array['servername'] = $tlsSettings['serverName']; | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|  |         if ($server['network'] === 'tcp') { | ||||||
|  |             $tcpSettings = $server['networkSettings']; | ||||||
|  |             if (isset($tcpSettings['header']['type'])) $array['network'] = $tcpSettings['header']['type']; | ||||||
|  |             if (isset($tcpSettings['header']['request']['path'][0])) $array['http-opts']['path'] = $tcpSettings['header']['request']['path'][0]; | ||||||
|  |         } | ||||||
|         if ($server['network'] === 'ws') { |         if ($server['network'] === 'ws') { | ||||||
|             $array['network'] = 'ws'; |             $array['network'] = 'ws'; | ||||||
|             if ($server['networkSettings']) { |             if ($server['networkSettings']) { | ||||||
|   | |||||||
| @@ -80,6 +80,11 @@ class General | |||||||
|                     $config['sni'] = $tlsSettings['serverName']; |                     $config['sni'] = $tlsSettings['serverName']; | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|  |         if ((string)$server['network'] === 'tcp') { | ||||||
|  |             $tcpSettings = $server['networkSettings']; | ||||||
|  |             if (isset($tcpSettings['header']['type'])) $config['type'] = $tcpSettings['header']['type']; | ||||||
|  |             if (isset($tcpSettings['header']['request']['path'][0])) $config['path'] = $tcpSettings['header']['request']['path'][0]; | ||||||
|  |         } | ||||||
|         if ((string)$server['network'] === 'ws') { |         if ((string)$server['network'] === 'ws') { | ||||||
|             $wsSettings = $server['networkSettings']; |             $wsSettings = $server['networkSettings']; | ||||||
|             if (isset($wsSettings['path'])) $config['path'] = $wsSettings['path']; |             if (isset($wsSettings['path'])) $config['path'] = $wsSettings['path']; | ||||||
|   | |||||||
| @@ -68,6 +68,11 @@ class Passwall | |||||||
|                     $config['sni'] = $tlsSettings['serverName']; |                     $config['sni'] = $tlsSettings['serverName']; | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|  |         if ((string)$server['network'] === 'tcp') { | ||||||
|  |             $tcpSettings = $server['networkSettings']; | ||||||
|  |             if (isset($tcpSettings['header']['type'])) $config['type'] = $tcpSettings['header']['type']; | ||||||
|  |             if (isset($tcpSettings['header']['request']['path'][0])) $config['path'] = $tcpSettings['header']['request']['path'][0]; | ||||||
|  |         } | ||||||
|         if ((string)$server['network'] === 'ws') { |         if ((string)$server['network'] === 'ws') { | ||||||
|             $wsSettings = $server['networkSettings']; |             $wsSettings = $server['networkSettings']; | ||||||
|             if (isset($wsSettings['path'])) $config['path'] = $wsSettings['path']; |             if (isset($wsSettings['path'])) $config['path'] = $wsSettings['path']; | ||||||
|   | |||||||
| @@ -72,6 +72,11 @@ class SagerNet | |||||||
|                     $config['sni'] = urlencode($tlsSettings['serverName']); |                     $config['sni'] = urlencode($tlsSettings['serverName']); | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|  |         if ((string)$server['network'] === 'tcp') { | ||||||
|  |             $tcpSettings = $server['networkSettings']; | ||||||
|  |             if (isset($tcpSettings['header']['type'])) $config['type'] = $tcpSettings['header']['type']; | ||||||
|  |             if (isset($tcpSettings['header']['request']['path'][0])) $config['path'] = $tcpSettings['header']['request']['path'][0]; | ||||||
|  |         } | ||||||
|         if ((string)$server['network'] === 'ws') { |         if ((string)$server['network'] === 'ws') { | ||||||
|             $wsSettings = $server['networkSettings']; |             $wsSettings = $server['networkSettings']; | ||||||
|             if (isset($wsSettings['path'])) $config['path'] = $wsSettings['path']; |             if (isset($wsSettings['path'])) $config['path'] = $wsSettings['path']; | ||||||
|   | |||||||
| @@ -82,6 +82,15 @@ class Shadowrocket | |||||||
|                     $config['peer'] = $tlsSettings['serverName']; |                     $config['peer'] = $tlsSettings['serverName']; | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|  |         if ($server['network'] === 'tcp') { | ||||||
|  |             if ($server['networkSettings']) { | ||||||
|  |                 $tcpSettings = $server['networkSettings']; | ||||||
|  |                 if (isset($tcpSettings['header']['type']) && !empty($tcpSettings['header']['type'])) | ||||||
|  |                     $config['obfs'] = $tcpSettings['header']['type']; | ||||||
|  |                 if (isset($tcpSettings['header']['request']['path'][0]) && !empty($tcpSettings['header']['request']['path'][0])) | ||||||
|  |                     $config['path'] = $tcpSettings['header']['request']['path'][0]; | ||||||
|  |             } | ||||||
|  |         } | ||||||
|         if ($server['network'] === 'ws') { |         if ($server['network'] === 'ws') { | ||||||
|             $config['obfs'] = "websocket"; |             $config['obfs'] = "websocket"; | ||||||
|             if ($server['networkSettings']) { |             if ($server['networkSettings']) { | ||||||
|   | |||||||
| @@ -125,6 +125,11 @@ class Stash | |||||||
|                     $array['servername'] = $tlsSettings['serverName']; |                     $array['servername'] = $tlsSettings['serverName']; | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|  |         if ($server['network'] === 'tcp') { | ||||||
|  |             $tcpSettings = $server['networkSettings']; | ||||||
|  |             if (isset($tcpSettings['header']['type'])) $array['network'] = $tcpSettings['header']['type']; | ||||||
|  |             if (isset($tcpSettings['header']['request']['path'][0])) $array['http-opts']['path'] = $tcpSettings['header']['request']['path'][0]; | ||||||
|  |         } | ||||||
|         if ($server['network'] === 'ws') { |         if ($server['network'] === 'ws') { | ||||||
|             $array['network'] = 'ws'; |             $array['network'] = 'ws'; | ||||||
|             if ($server['networkSettings']) { |             if ($server['networkSettings']) { | ||||||
|   | |||||||
| @@ -80,6 +80,11 @@ class V2rayN | |||||||
|                     $config['sni'] = $tlsSettings['serverName']; |                     $config['sni'] = $tlsSettings['serverName']; | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|  |         if ((string)$server['network'] === 'tcp') { | ||||||
|  |             $tcpSettings = $server['networkSettings']; | ||||||
|  |             if (isset($tcpSettings['header']['type'])) $config['type'] = $tcpSettings['header']['type']; | ||||||
|  |             if (isset($tcpSettings['header']['request']['path'][0])) $config['path'] = $tcpSettings['header']['request']['path'][0]; | ||||||
|  |         } | ||||||
|         if ((string)$server['network'] === 'ws') { |         if ((string)$server['network'] === 'ws') { | ||||||
|             $wsSettings = $server['networkSettings']; |             $wsSettings = $server['networkSettings']; | ||||||
|             if (isset($wsSettings['path'])) $config['path'] = $wsSettings['path']; |             if (isset($wsSettings['path'])) $config['path'] = $wsSettings['path']; | ||||||
|   | |||||||
| @@ -68,6 +68,11 @@ class V2rayNG | |||||||
|                     $config['sni'] = $tlsSettings['serverName']; |                     $config['sni'] = $tlsSettings['serverName']; | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|  |         if ((string)$server['network'] === 'tcp') { | ||||||
|  |             $tcpSettings = $server['networkSettings']; | ||||||
|  |             if (isset($tcpSettings['header']['type'])) $config['type'] = $tcpSettings['header']['type']; | ||||||
|  |             if (isset($tcpSettings['header']['request']['path'][0])) $config['path'] = $tcpSettings['header']['request']['path'][0]; | ||||||
|  |         } | ||||||
|         if ((string)$server['network'] === 'ws') { |         if ((string)$server['network'] === 'ws') { | ||||||
|             $wsSettings = $server['networkSettings']; |             $wsSettings = $server['networkSettings']; | ||||||
|             if (isset($wsSettings['path'])) $config['path'] = $wsSettings['path']; |             if (isset($wsSettings['path'])) $config['path'] = $wsSettings['path']; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user