OSDN Git Service

luci-app-unblockneteasemusic: rewrite func to add pub_access rule
[immortalwrt/luci.git] / applications / luci-app-unblockneteasemusic / root / usr / share / unblockneteasemusic / rules / chain.uc
1 {%
2
3 let http_port = o_http_port;
4 let https_port = o_https_port;
5 let pub_access = o_pub_access;
6
7 %}
8
9 {% if (pub_access == 1): %}
10 chain input_wan {
11         tcp dport {{ http_port }}-{{ https_port }} counter accept comment "!fw4: unblockneteasemusic-pub-access"
12 }
13 {% endif %}
14
15 chain netease_cloud_music {
16         type nat hook prerouting priority -1; policy accept;
17         meta l4proto tcp ip daddr @neteasemusic_ipv4 jump netease_cloud_music_redir;
18         meta l4proto tcp ip6 daddr @neteasemusic_ipv6 jump netease_cloud_music_redir;
19 }
20
21 chain netease_cloud_music_redir {
22         ip daddr @local_addr_ipv4 return;
23         ip saddr @acl_neteasemusic_http_ipv4 accept;
24         ip saddr @acl_neteasemusic_https_ipv4 accept;
25         ip6 daddr @local_addr_ipv6 return;
26         ip6 saddr @acl_neteasemusic_http_ipv6 accept;
27         ip6 saddr @acl_neteasemusic_https_ipv6 accept;
28         tcp dport 80 counter redirect to :{{ http_port }};
29         tcp dport 443 counter redirect to :{{ https_port }};
30 }