12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- #!/usr/bin/utpl -S
- {% if (acl_http_addr): -%}
- set acl_neteasemusic_http {
- type ipv4_addr;
- flags interval;
- auto-merge;
- elements = {
- {% for (let addr in split(trim(acl_http_addr), '\n')): %}
- {{ addr }},
- {% endfor %}
- };
- }
- {% endif -%}
- {% if (acl_https_addr): %}
- set acl_neteasemusic_https {
- type ipv4_addr;
- flags interval;
- auto-merge;
- elements = {
- {% for (let addr in split(trim(acl_https_addr), '\n')): %}
- {{ addr }},
- {% endfor %}
- };
- }
- {% endif -%}
- {% if (hijack_ways === 'use_ipset'): %}
- set neteasemusic {
- type ipv4_addr;
- flags interval;
- auto-merge;
- elements = {
- {% for (let addr in split(trim(neteasemusic_addr), '\n')): %}
- {{ addr }},
- {% endfor %}
- }
- }
- chain netease_cloud_music {
- type nat hook prerouting priority -1; policy accept;
- meta l4proto tcp ip daddr @neteasemusic jump netease_cloud_music_redir;
- }
- chain netease_cloud_music_redir {
- ip daddr { 0.0.0.0/8, 10.0.0.0/8, 100.64.0.0/10, 127.0.0.0/8,
- 169.254.0.0/16, 172.16.0.0/12, 192.0.0.0/24,
- 192.0.2.0/24, 192.31.196.0/24, 192.52.193.0/24,
- 192.88.99.0/24, 192.168.0.0/16, 192.175.48.0/24,
- 198.18.0.0/15, 198.51.100.0/24, 203.0.113.0/24,
- 224.0.0.0/4, 240.0.0.0/4 } counter return;
- {% if (acl_http_addr): %}
- ip saddr @acl_neteasemusic_http tcp dport 80 counter return;
- {% endif %}
- {% if (acl_https_addr): %}
- ip saddr @acl_neteasemusic_https tcp dport 443 counter return;
- {% endif %}
- tcp dport 80 counter redirect to :{{ http_port }};
- tcp dport 443 counter redirect to :{{ https_port }};
- }
- {% endif %}
|