diff --git a/luci-app-youtubeUnblock/luasrc/model/cbi/youtubeUnblock.lua b/luci-app-youtubeUnblock/luasrc/model/cbi/youtubeUnblock.lua index 7678aa3..08ed910 100644 --- a/luci-app-youtubeUnblock/luasrc/model/cbi/youtubeUnblock.lua +++ b/luci-app-youtubeUnblock/luasrc/model/cbi/youtubeUnblock.lua @@ -4,100 +4,7 @@ local m = Map("youtubeUnblock", "youtubeUnblock", "Bypasses Deep Packet Inspecti local s = m:section(NamedSection, "youtubeUnblock", "youtubeUnblock", "youtubeUnblock", "Config. Check the README for more details https://github.com/Waujito/youtubeUnblock") local o -s:option(Flag, "fake_sni", "fake sni", "This flag enables fake-sni which forces youtubeUnblock to send at least three packets instead of one with TLS ClientHello: Fake ClientHello, 1st part of original ClientHello, 2nd part of original ClientHello. This flag may be related to some Operation not permitted error messages, so before open an issue refer to Troubleshooting for EPERMS.") - -o = s:option(ListValue, "faking_strategy", "faking strategy", - [[ - This flag determines the strategy of fake packets invalidation. -
randseq specifies that random sequence/acknowledgment random will be set. This option may be handled by provider which uses conntrack with drop on invalid conntrack state firewall rule enabled. ttl specifies that packet will be invalidated after --faking-ttl=n hops. ttl is better but may cause issues if unconfigured. pastseq is like randseq but sequence number is not random but references the packet sent in the past (before current). tcp_check will invalidate faking packet with invalid checksum. May be handled and dropped by some providers/TSPUs.md5sum will invalidate faking packet with invalid TCP md5sum. md5sum is a TCP option which is handled by the destination server but may be skipped by TSPU.default.")
-o:value("default", "default")
-o:value("custom", "custom")
-o:value("random", "random")
-o.widget="radio"
-o:depends("fake_sni", 1)
-
-o = s:option(Value, "fake_custom_payload", "fake custom payload", "Useful with --fake-sni-type=custom. You should specify the payload for fake message manually. Use hex format: --fake-custom-payload=0001020304 mean that 5 bytes sequence: 0x00, 0x01, 0x02, 0x03, 0x04 used as fake.")
-o:depends("fake_sni_type", "custom")
-
-o = s:option(ListValue, "frag", "fragmentation strategy", "Specifies the fragmentation strategy for the packet. Tcp is used by default. Ip fragmentation may be blocked by DPI system. None specifies no fragmentation. Probably this won't work, but may be will work for some fake sni strategies.")
-o:value("tcp", "tcp")
-o:value("ip", "ip")
-o:value("none", "none")
-o.widget="radio"
-
-o = s:option(Flag, "frag_sni_reverse", "frag sni reverse", "Specifies youtubeUnblock to send ClientHello fragments in the reverse order.")
-o:depends("frag", "tcp")
-o:depends("frag", "ip")
-
-o = s:option(Flag, "frag_sni_faked", "frag sni faked", "Specifies youtubeUnblock to send fake packets near ClientHello (fills payload with zeroes).")
-o:depends("frag", "tcp")
-o:depends("frag", "ip")
-
-o = s:option(Flag, "frag_middle_sni", "frag middle sni", "With this options youtubeUnblock will split the packet in the middle of SNI data.")
-o:depends("frag", "tcp")
-o:depends("frag", "ip")
-
-o = s:option(Value, "frag_sni_pos", "frag sni pos", "With this option youtubeUnblock will split the packet at the position pos.")
-o:depends("frag", "tcp")
-o:depends("frag", "ip")
-
-o = s:option(Flag, "quic_drop", "drop quic", "Drop all QUIC packets which goes to youtubeUnblock. Won't affect any other UDP packets. Suitable for some TVs. Note, that for this option to work you should also add proxy udp to youtubeUnblock in firewall. connbytes may also be used with udp.")
-
-o = s:option(Value, "fk_winsize", "frag winsize", "Specifies window size for the fragmented TCP packet. Applicable if you want for response to be fragmented. May slowdown connection initialization. Pass 0 if you don't want this.")
-o:depends("frag", "tcp")
-o:depends("frag", "ip")
-
-o = s:option(Flag, "synfake", "synfake", "If 1, syn payload will be sent before each request. The idea is taken from syndata from zapret project. Syn payload will normally be discarded by endpoint but may be handled by TSPU. This option sends normal fake in that payload. Please note, that the option works for all the sites, so --sni-domains won't change anything.")
-
-o = s:option(Value, "synfake_len", "synfake len", "The fake packet sent in synfake may be too large. If you experience issues, lower up synfake-len. where len stands for how much bytes should be sent as syndata. Pass 0 if you want to send an entire fake packet.")
-o:depends("synfake", 1)
-
-o = s:option(Value, "seg2delay", "seg2delay", "This flag forces youtubeUnblock to wait a little bit before send the 2nd part of the split packet.")
-
-o = s:option(Flag, "silent", "silent", "Disables verbose mode")
-o:depends("trace", 0)
-
-o = s:option(Flag, "trace", "trace", "Maximum verbosity for debug purposes")
-o:depends("silent", 0)
-
-o = s:option(Flag, "no_gso", "no gso", "Disables support for Google Chrome fat packets which uses GSO. This feature is well tested now, so this flag probably won't fix anything.")
-
-o = s:option(Flag, "no_ipv6", "disable ipv6", "Disables support for ipv6. May be useful if you don't want for ipv6 socket to be opened.")
-
-o = s:option(Value, "packet_mark", "packet mark", "Use this option if youtubeUnblock conflicts with other systems rely on packet mark. Note that you may want to change accept rule for iptables to follow the mark.")
-
-o = s:option(Flag, "all_domains", "Target all domains", "Use this option if you want for every ClientHello to be handled")
-o = s:option(DynamicList, "sni_domains", "sni domains", "List of domains you want to be handled by SNI.")
-o:depends("all_domains", 0)
-
-o = s:option(DynamicList, "exclude_domains", "excluded domains", "List of domains to be excluded from targeting.")
-
-o = s:option(Value, "post_args", "Post args", "Anything you pass here will be passed to youtubeUnblock as raw args")
+o = s:option(TextValue, "args", "args", "Pass your list of arguments here.")
local bs = m:section(NamedSection, "youtubeUnblock", "youtubeUnblock", "Service status")
diff --git a/youtubeUnblock/files/etc/init.d/youtubeUnblock b/youtubeUnblock/files/etc/init.d/youtubeUnblock
index abce389..b1d7d8a 100755
--- a/youtubeUnblock/files/etc/init.d/youtubeUnblock
+++ b/youtubeUnblock/files/etc/init.d/youtubeUnblock
@@ -8,78 +8,15 @@ USE_PROCD=1
# PROCD_DEBUG=1
PROG=/usr/bin/youtubeUnblock
-# You should use uci for configuration
-OPTS=""
+UCI_ARGS=""
-# If you prefer to pass args as cmdline arguments, pass them here
+# If you have troubles with uci, pass args here
POST_ARGS=""
-xappend() {
- local name="$1" value="$2"
- OPTS="$OPTS --${name//_/-}=$value"
-}
-
-xappend_toggler() {
- local name="$1"
- OPTS="$OPTS --${name//_/-}"
-}
-
-append_opts() {
- local name value cfg="$1"; shift
- for name in $*; do
- config_get value "$cfg" "$name"
- [ -n "$value" ] && xappend "$name" "$value"
- done
-}
-
-append_commasep_list() {
- local name cfg="$1"; shift
- for name in $*; do
- local res=""
- _handle_list() {
- res="$res$1,"
- }
- config_list_foreach "$cfg" "$name" _handle_list
- [ -n "$res" ] && xappend "$name" "$res"
- done
-}
-
-append_opts_boolean() {
- local name value cfg="$1"; shift
- for name in $*; do
- config_get_bool value "$cfg" "$name" 0
- xappend "$name" "$value"
- done
-}
-
-append_opts_btoggler() {
- local name value cfg="$1"; shift
- for name in $*; do
- config_get_bool value "$cfg" "$name" 0
- [ $value -gt 0 ] && xappend_toggler "$name"
- done
-}
-
-parse_options() {
- local config="$1"
+read_uci_args() {
local value
- config_get_bool value "$config" all_domains 0
-
- if [ $value -gt 0 ]; then
- xappend "sni_domains" "all"
- else
- append_commasep_list "$config" sni_domains
- fi
-
- append_opts "$config" queue_num fake_sni_seq_len faking_strategy faking_ttl fake_seq_offset frag frag_sni_pos fk_winsize synfake_len seg2delay packet_mark fake_sni_ty
- append_commasep_list "$config" exclude_domains
- append_opts_boolean "$config" fake_sni frag_sni_reverse frag_sni_faked frag_middle_sni synfake
- append_opts_btoggler "$config" quic_drop silent trace no_gso no_ipv6
-
- config_get value "$config" post_args
- if [ -n "$value" ]; then
- OPTS="$OPTS $value"
- fi
+ config_get value "$1" "args"
+ UCI_ARGS="$value"
}
# Openwrt procd script: https://openwrt.org/docs/guide-developer/procd-init-script-example
@@ -88,12 +25,12 @@ parse_options() {
start_service() {
config_load youtubeUnblock
- config_foreach parse_options youtubeUnblock
+ read_uci_args youtubeUnblock
- echo "youtubeUnblock is running as: '$PROG $OPTS $POST_ARGS'"
+ echo "youtubeUnblock is running as: '$PROG $UCI_ARGS $POST_ARGS'"
procd_open_instance 'youtubeUnblock'
- procd_set_param command $PROG $OPTS $POST_ARGS
+ procd_set_param command $PROG $UCI_ARGS $POST_ARGS
procd_set_param stdout 1
procd_set_param stderr 1
procd_close_instance
diff --git a/youtubeUnblock/files/etc/uci-defaults/99-youtubeUnblock.sh b/youtubeUnblock/files/etc/uci-defaults/99-youtubeUnblock.sh
index 6d4ecd0..2ef1029 100644
--- a/youtubeUnblock/files/etc/uci-defaults/99-youtubeUnblock.sh
+++ b/youtubeUnblock/files/etc/uci-defaults/99-youtubeUnblock.sh
@@ -5,28 +5,6 @@
touch /etc/config/youtubeUnblock
uci batch << EOI
set youtubeUnblock.youtubeUnblock='youtubeUnblock'
-set youtubeUnblock.youtubeUnblock.frag='tcp'
-set youtubeUnblock.youtubeUnblock.frag_sni_reverse='1'
-set youtubeUnblock.youtubeUnblock.frag_middle_sni='1'
-set youtubeUnblock.youtubeUnblock.frag_sni_pos='1'
-set youtubeUnblock.youtubeUnblock.fk_winsize='0'
-set youtubeUnblock.youtubeUnblock.seg2delay='0'
-set youtubeUnblock.youtubeUnblock.packet_mark='32768'
-set youtubeUnblock.youtubeUnblock.fake_sni='1'
-set youtubeUnblock.youtubeUnblock.faking_strategy='pastseq'
-set youtubeUnblock.youtubeUnblock.fake_sni_seq_len='1'
-set youtubeUnblock.youtubeUnblock.fake_sni_type='default'
-set youtubeUnblock.youtubeUnblock.fake_custom_payload=''
-set youtubeUnblock.youtubeUnblock.post_args=''
-add_list youtubeUnblock.youtubeUnblock.sni_domains='googlevideo.com'
-add_list youtubeUnblock.youtubeUnblock.sni_domains='ggpht.com'
-add_list youtubeUnblock.youtubeUnblock.sni_domains='ytimg.com'
-add_list youtubeUnblock.youtubeUnblock.sni_domains='youtube.com'
-add_list youtubeUnblock.youtubeUnblock.sni_domains='play.google.com'
-add_list youtubeUnblock.youtubeUnblock.sni_domains='youtu.be'
-add_list youtubeUnblock.youtubeUnblock.sni_domains='googleapis.com'
-add_list youtubeUnblock.youtubeUnblock.sni_domains='googleusercontent.com'
-add_list youtubeUnblock.youtubeUnblock.sni_domains='gstatic.com'
-add_list youtubeUnblock.youtubeUnblock.sni_domains='l.google.com'
+set youtubeUnblock.youtubeUnblock.args=''
EOI
uci commit