Update publish.yml

Update publish.yml

Update publish.yml

Update go.yml
This commit is contained in:
日下部 詩 2021-12-27 00:47:56 +08:00 committed by Kusakabe Si
parent cdb096b8e4
commit acb750ea5e
4 changed files with 23 additions and 36 deletions

View File

@ -19,7 +19,7 @@ jobs:
echo "deb [trusted=yes] https://packagecloud.io/fdio/release/ubuntu focal main" | sudo tee -a /etc/apt/sources.list.d/99fd.io.list > /dev/null echo "deb [trusted=yes] https://packagecloud.io/fdio/release/ubuntu focal main" | sudo tee -a /etc/apt/sources.list.d/99fd.io.list > /dev/null
curl -L https://packagecloud.io/fdio/release/gpgkey | sudo apt-key add - curl -L https://packagecloud.io/fdio/release/gpgkey | sudo apt-key add -
sudo apt-get -y update sudo apt-get -y update
sudo apt-get install -y vpp vpp-plugin-core python3-vpp-api vpp-dbg vpp-dev libmemif libmemif-dev sudo apt-get install -y libmemif libmemif-dev
sudo apt-get install -y wireguard-tools upx-ucl sudo apt-get install -y wireguard-tools upx-ucl
- name: Build x86_64 - name: Build x86_64
@ -77,7 +77,7 @@ jobs:
add-apt-repository ppa:longsleep/golang-backports add-apt-repository ppa:longsleep/golang-backports
apt-get -y update apt-get -y update
apt-get install -y vpp vpp-plugin-core python3-vpp-api vpp-dbg vpp-dev libmemif libmemif-dev || true apt-get install -y libmemif libmemif-dev || true
apt-get install -y wireguard-tools golang-go build-essential git apt-get install -y wireguard-tools golang-go build-essential git
run: | run: |
make all static make all static

View File

@ -21,7 +21,7 @@ jobs:
echo "deb [trusted=yes] https://packagecloud.io/fdio/release/ubuntu focal main" | sudo tee -a /etc/apt/sources.list.d/99fd.io.list > /dev/null echo "deb [trusted=yes] https://packagecloud.io/fdio/release/ubuntu focal main" | sudo tee -a /etc/apt/sources.list.d/99fd.io.list > /dev/null
curl -L https://packagecloud.io/fdio/release/gpgkey | sudo apt-key add - curl -L https://packagecloud.io/fdio/release/gpgkey | sudo apt-key add -
sudo apt-get -y update sudo apt-get -y update
sudo apt-get install -y vpp vpp-plugin-core python3-vpp-api vpp-dbg vpp-dev libmemif libmemif-dev sudo apt-get install -y libmemif libmemif-dev
sudo apt-get install -y wireguard-tools upx-ucl sudo apt-get install -y wireguard-tools upx-ucl
- name: Build x86_64 - name: Build x86_64
@ -38,6 +38,7 @@ jobs:
with: with:
repo_token: ${{ secrets.GITHUB_TOKEN }} repo_token: ${{ secrets.GITHUB_TOKEN }}
file: etherguard-go file: etherguard-go
overwrite: true
asset_name: etherguard-go-x86_64 asset_name: etherguard-go-x86_64
tag: ${{ github.ref }} tag: ${{ github.ref }}
@ -46,7 +47,8 @@ jobs:
with: with:
repo_token: ${{ secrets.GITHUB_TOKEN }} repo_token: ${{ secrets.GITHUB_TOKEN }}
file: etherguard-go-vpp file: etherguard-go-vpp
asset_name: etherguard-go-x86_64 overwrite: true
asset_name: etherguard-go-vpp-x86_64
tag: ${{ github.ref }} tag: ${{ github.ref }}
- name: Upload x86_64 static build - name: Upload x86_64 static build
@ -54,6 +56,7 @@ jobs:
with: with:
repo_token: ${{ secrets.GITHUB_TOKEN }} repo_token: ${{ secrets.GITHUB_TOKEN }}
file: etherguard-go-static file: etherguard-go-static
overwrite: true
asset_name: etherguard-go-static-x86_64 asset_name: etherguard-go-static-x86_64
tag: ${{ github.ref }} tag: ${{ github.ref }}
@ -74,24 +77,16 @@ jobs:
repo_token: ${{ secrets.GITHUB_TOKEN }} repo_token: ${{ secrets.GITHUB_TOKEN }}
file: etherguard-go file: etherguard-go
asset_name: etherguard-go-mipsle asset_name: etherguard-go-mipsle
overwrite: true
tag: ${{ github.ref }} tag: ${{ github.ref }}
- name: Upload mipsle dynamic vpp build
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: etherguard-go-vpp
asset_name: etherguard-go-mipsle
tag: ${{ github.ref }}
- name: Upload mipsle static build - name: Upload mipsle static build
uses: svenstaro/upload-release-action@v2 uses: svenstaro/upload-release-action@v2
with: with:
repo_token: ${{ secrets.GITHUB_TOKEN }} repo_token: ${{ secrets.GITHUB_TOKEN }}
file: etherguard-go-static file: etherguard-go-static
asset_name: etherguard-go-static-mipsle asset_name: etherguard-go-static-mipsle
overwrite: true
tag: ${{ github.ref }} tag: ${{ github.ref }}
multi-arch: multi-arch:
@ -128,7 +123,7 @@ jobs:
add-apt-repository ppa:longsleep/golang-backports add-apt-repository ppa:longsleep/golang-backports
apt-get -y update apt-get -y update
apt-get install -y vpp vpp-plugin-core python3-vpp-api vpp-dbg vpp-dev libmemif libmemif-dev || true apt-get install -y libmemif libmemif-dev || true
apt-get install -y wireguard-tools golang-go build-essential git apt-get install -y wireguard-tools golang-go build-essential git
run: | run: |
make all static make all static
@ -152,8 +147,9 @@ jobs:
uses: svenstaro/upload-release-action@v2 uses: svenstaro/upload-release-action@v2
with: with:
repo_token: ${{ secrets.GITHUB_TOKEN }} repo_token: ${{ secrets.GITHUB_TOKEN }}
file: artifacts/${{ martix.arch }}/etherguard-go file: artifacts/${{ matrix.arch }}/etherguard-go
asset_name: etherguard-go-${{ martix.arch }} asset_name: etherguard-go-${{ matrix.arch }}
overwrite: true
tag: ${{ github.ref }} tag: ${{ github.ref }}
- name: Upload ${{ matrix.arch }} dynamic vpp build - name: Upload ${{ matrix.arch }} dynamic vpp build
@ -161,14 +157,16 @@ jobs:
uses: svenstaro/upload-release-action@v2 uses: svenstaro/upload-release-action@v2
with: with:
repo_token: ${{ secrets.GITHUB_TOKEN }} repo_token: ${{ secrets.GITHUB_TOKEN }}
file: artifacts/${{ martix.arch }}/etherguard-go file: artifacts/${{ matrix.arch }}/etherguard-go
asset_name: etherguard-go-${{ martix.arch }} asset_name: etherguard-go-vpp-${{ matrix.arch }}
overwrite: true
tag: ${{ github.ref }} tag: ${{ github.ref }}
- name: Upload ${{ matrix.arch }} static build - name: Upload ${{ matrix.arch }} static build
uses: svenstaro/upload-release-action@v2 uses: svenstaro/upload-release-action@v2
with: with:
repo_token: ${{ secrets.GITHUB_TOKEN }} repo_token: ${{ secrets.GITHUB_TOKEN }}
file: artifacts/${{ martix.arch }}/etherguard-go-static file: artifacts/${{ matrix.arch }}/etherguard-go-static
asset_name: etherguard-go-static-${{ martix.arch }} asset_name: etherguard-go-static-${{ matrix.arch }}
overwrite: true
tag: ${{ github.ref }} tag: ${{ github.ref }}

1
.gitignore vendored
View File

@ -1,4 +1,5 @@
etherguard-go etherguard-go
etherguard-go-vpp etherguard-go-vpp
etherguard-go-static
vendor vendor
.ipynb_checkpoints .ipynb_checkpoints

View File

@ -11,7 +11,6 @@ import (
"errors" "errors"
"fmt" "fmt"
"io/ioutil" "io/ioutil"
"math"
"net" "net"
"sort" "sort"
"sync" "sync"
@ -187,19 +186,8 @@ func (f *filterwindow) Push(e float64) float64 {
f.value = e f.value = e
return f.value return f.value
} }
pivot := ((elemlen + 1) / 2) - 1 f.value = f.filter(window, 2)
left := window[:pivot+1]
right := window[pivot:]
lm := f.filter(left, 1)
rm := f.filter(right, 2)
pv := window[pivot]
ldiff := math.Abs(lm - pv)
rdiff := math.Abs(rm - pv)
if ldiff < rdiff {
f.value = lm
} else {
f.value = rm
}
return f.value return f.value
} }