mirror of
https://github.com/Waujito/youtubeUnblock.git
synced 2024-12-22 06:15:31 +00:00
Add workflow for test build
This commit is contained in:
parent
3ee979f7d1
commit
98a3fd5acd
171
.github/workflows/test.yml
vendored
Normal file
171
.github/workflows/test.yml
vendored
Normal file
@ -0,0 +1,171 @@
|
||||
# Tests whether the youtubeUnblock builds properly
|
||||
|
||||
name: "youtubeUnblock build test"
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ "main" ]
|
||||
paths-ignore:
|
||||
- '.editorconfig'
|
||||
- '.gitignore'
|
||||
- 'LICENSE'
|
||||
- 'README.md'
|
||||
|
||||
pull_request:
|
||||
branches: [ "main" ]
|
||||
paths-ignore:
|
||||
- '.editorconfig'
|
||||
- '.gitignore'
|
||||
- 'LICENSE'
|
||||
- 'README.md'
|
||||
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
prepare:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
version: ${{ steps.gh.outputs.version }}
|
||||
sha: ${{ steps.gh.outputs.sha }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: 'openwrt'
|
||||
|
||||
- name: GH
|
||||
id: gh
|
||||
env:
|
||||
REPO: ${{ github.repository }}
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
shell: bash
|
||||
run: |
|
||||
echo "version=$(cat youtubeUnblock/Makefile | grep PKG_VERSION | sed 's/PKG_VERSION:=//')" >> $GITHUB_OUTPUT
|
||||
if [[ "${{ github.event_name }}" != "pull_request" ]]; then
|
||||
echo "sha=$(echo ${GITHUB_SHA::7})" >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo "sha=$(gh api repos/$REPO/commits/main --jq '.sha[:7]')" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
build-static:
|
||||
needs: prepare
|
||||
name: build-static ${{ matrix.arch }}
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
arch: [x86_64]
|
||||
branch: [latest-stable]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Build
|
||||
id: build
|
||||
env:
|
||||
ARCH: ${{ matrix.arch }}
|
||||
VERSION: ${{ needs.prepare.outputs.version }}
|
||||
SHA: ${{ needs.prepare.outputs.sha }}
|
||||
shell: bash
|
||||
run: |
|
||||
make -j$(nproc)
|
||||
strip -s build/youtubeUnblock
|
||||
cp -va build/youtubeUnblock .
|
||||
tar -czvf static-youtubeUnblock-$VERSION-$SHA-$PLATFORM.tar.gz youtubeUnblock youtubeUnblock.service README.md
|
||||
|
||||
- name: Upload artifacts
|
||||
if: steps.build.outcome == 'success'
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: static-youtubeUnblock-${{ matrix.arch }}
|
||||
path: ./**/youtubeUnblock*.tar.gz
|
||||
|
||||
build-kmod:
|
||||
needs: prepare
|
||||
name: build-kmod ${{ matrix.arch }}
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
arch: [x86_64]
|
||||
branch: [latest-stable]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Build
|
||||
id: build
|
||||
env:
|
||||
ARCH: ${{ matrix.arch }}
|
||||
VERSION: ${{ needs.prepare.outputs.version }}
|
||||
SHA: ${{ needs.prepare.outputs.sha }}
|
||||
shell: bash
|
||||
run: |
|
||||
make kmake
|
||||
tar -czvf kmod-youtubeUnblock-$VERSION-$SHA-$PLATFORM-$(uname -r).tar.gz kyoutubeUnblock.ko
|
||||
|
||||
- name: Upload artifacts
|
||||
if: steps.build.outcome == 'success'
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: kmod-youtubeUnblock-${{ matrix.arch }}
|
||||
path: ./**/kmod-youtubeUnblock*.tar.gz
|
||||
|
||||
build-kmod-20.04:
|
||||
needs: prepare
|
||||
name: build-kmod ${{ matrix.arch }}
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
arch: [x86_64]
|
||||
branch: [latest-stable]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: prepare runner
|
||||
shell: bash
|
||||
run: |
|
||||
apt install -y \
|
||||
bridge-utils \
|
||||
qemu-kvm \
|
||||
libvirt-daemon-system \
|
||||
libvirt-clients \
|
||||
virtinst \
|
||||
libguestfs-tools \
|
||||
wait-for-it \
|
||||
whois \
|
||||
sshpass
|
||||
|
||||
- name: build virtual machine
|
||||
shell: bash
|
||||
run: |
|
||||
virt-builder ubuntu-20.04 \
|
||||
--network \
|
||||
--format qcow2 -o "vm_ubuntu.qcow2" \
|
||||
--update \
|
||||
--install build-essential \
|
||||
--run-command "useradd -p '' -s /bin/bash -m -G sudo ubuntu" \
|
||||
--edit '/etc/sudoers:s/^%sudo.*/%sudo ALL=(ALL) NOPASSWD:ALL/' \
|
||||
--edit '/etc/default/grub:s/^GRUB_CMDLINE_LINUX_DEFAULT=.*/GRUB_CMDLINE_LINUX_DEFAULT="console=tty0 console=ttyS0,115200n8"/' \
|
||||
--run-command update-grub
|
||||
|
||||
|
||||
|
||||
|
||||
- name: Build
|
||||
id: build
|
||||
env:
|
||||
ARCH: ${{ matrix.arch }}
|
||||
VERSION: ${{ needs.prepare.outputs.version }}
|
||||
SHA: ${{ needs.prepare.outputs.sha }}
|
||||
shell: bash
|
||||
run: |
|
||||
make kmake
|
||||
tar -czvf kmod-youtubeUnblock-$VERSION-$SHA-$PLATFORM-$(uname -r).tar.gz kyoutubeUnblock.ko
|
||||
|
||||
- name: Upload artifacts
|
||||
if: steps.build.outcome == 'success'
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: kmod-youtubeUnblock-${{ matrix.arch }}
|
||||
path: ./**/kmod-youtubeUnblock*.tar.gz
|
||||
|
12
tls.c
12
tls.c
@ -248,7 +248,7 @@ brute:
|
||||
vrd.target_sni = 1;
|
||||
vrd.sni_len = domain_len;
|
||||
vrd.sni_offset = (k - domain_len - 1);
|
||||
vrd.sni_target_offset = vrd.sni_offset
|
||||
vrd.sni_target_offset = vrd.sni_offset;
|
||||
NETBUF_FREE(buf);
|
||||
NETBUF_FREE(nzbuf);
|
||||
goto out;
|
||||
@ -273,7 +273,13 @@ int gen_fake_sni(struct fake_type type,
|
||||
|
||||
uint32_t data_len = type.fake_len;
|
||||
if (type.type == FAKE_PAYLOAD_RANDOM && data_len == 0) {
|
||||
#ifdef KERNEL_SPACE
|
||||
|
||||
// get_random_bytes(&data_len, sizeof(data_len));
|
||||
data_len = get_random_u32() % 1200;
|
||||
#else
|
||||
data_len = random() % 1200;
|
||||
#endif
|
||||
} else if (type.type == FAKE_PAYLOAD_DEFAULT) {
|
||||
data_len = config.fake_sni_pkt_sz;
|
||||
}
|
||||
@ -318,7 +324,11 @@ int gen_fake_sni(struct fake_type type,
|
||||
memcpy(bfdptr, type.fake_data, data_len);
|
||||
break;
|
||||
default: // FAKE_PAYLOAD_RANDOM
|
||||
#ifdef KERNEL_SPACE
|
||||
get_random_bytes(bfdptr, data_len);
|
||||
#else
|
||||
getrandom(bfdptr, data_len, 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (ipxv == IP4VERSION) {
|
||||
|
Loading…
Reference in New Issue
Block a user