Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump actions/upload-artifact from 3 to 4 #12

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
mv build/*.tar.gz release

- name: Upload artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: linux-latest
path: release
Expand Down Expand Up @@ -55,7 +55,7 @@ jobs:
mv dist\windows\wintun build\dist\windows\

- name: Upload artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: windows-latest
path: build
Expand Down Expand Up @@ -104,7 +104,7 @@ jobs:
fi

- name: Upload artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: darwin-latest
path: ./release/*
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
- name: Build test mobile
run: make build-test-mobile

- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: e2e packet flow
path: e2e/mermaid/
Expand Down Expand Up @@ -97,7 +97,7 @@ jobs:
- name: End 2 end
run: make e2evv

- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: e2e packet flow
path: e2e/mermaid/
Expand Down
25 changes: 25 additions & 0 deletions overlay/route.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package overlay

import (
"bytes"
"fmt"
"math"
"net"
Expand All @@ -21,6 +22,30 @@ type Route struct {
Install bool
}

func (r Route) Equal(t Route) bool {
if !r.Cidr.IP.Equal(t.Cidr.IP) {
return false
}
if !bytes.Equal(r.Cidr.Mask, t.Cidr.Mask) {
return false
}
if r.Metric != t.Metric {
return false
}
if r.MTU != t.MTU {
return false
}
return true
}

func (r Route) String() string {
s := r.Cidr.String()
if r.Metric != 0 {
s += fmt.Sprintf(" metric: %v", r.Metric)
}
return s
}

func makeRouteTree(l *logrus.Logger, routes []Route, allowMTU bool) (*cidr.Tree4[iputil.VpnIp], error) {
routeTree := cidr.NewTree4[iputil.VpnIp]()
for _, r := range routes {
Expand Down
77 changes: 39 additions & 38 deletions overlay/tun.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,60 +10,61 @@

const DefaultMTU = 1300

// TODO: We may be able to remove routines
type DeviceFactory func(c *config.C, l *logrus.Logger, tunCidr *net.IPNet, routines int) (Device, error)

func NewDeviceFromConfig(c *config.C, l *logrus.Logger, tunCidr *net.IPNet, routines int) (Device, error) {
routes, err := parseRoutes(c, tunCidr)
if err != nil {
return nil, util.NewContextualError("Could not parse tun.routes", nil, err)
}

unsafeRoutes, err := parseUnsafeRoutes(c, tunCidr)
if err != nil {
return nil, util.NewContextualError("Could not parse tun.unsafe_routes", nil, err)
}
routes = append(routes, unsafeRoutes...)

switch {
case c.GetBool("tun.disabled", false):
tun := newDisabledTun(tunCidr, c.GetInt("tun.tx_queue", 500), c.GetBool("stats.message_metrics", false), l)
return tun, nil

default:
return newTun(
l,
c.GetString("tun.dev", ""),
tunCidr,
c.GetInt("tun.mtu", DefaultMTU),
routes,
c.GetInt("tun.tx_queue", 500),
routines > 1,
c.GetBool("tun.use_system_route_table", false),
)
return newTun(c, l, tunCidr, routines > 1)

Check failure on line 23 in overlay/tun.go

View workflow job for this annotation

GitHub Actions / Build all and test on ubuntu-linux

not enough arguments in call to newTun

Check failure on line 23 in overlay/tun.go

View workflow job for this annotation

GitHub Actions / Build and test on linux with boringcrypto

not enough arguments in call to newTun

Check failure on line 23 in overlay/tun.go

View workflow job for this annotation

GitHub Actions / Build and test on macos-11

not enough arguments in call to newTun
}
}

func NewFdDeviceFromConfig(fd *int) DeviceFactory {
return func(c *config.C, l *logrus.Logger, tunCidr *net.IPNet, routines int) (Device, error) {
routes, err := parseRoutes(c, tunCidr)
if err != nil {
return nil, util.NewContextualError("Could not parse tun.routes", nil, err)
}
return newTunFromFd(c, l, *fd, tunCidr)

Check failure on line 29 in overlay/tun.go

View workflow job for this annotation

GitHub Actions / Build all and test on ubuntu-linux

not enough arguments in call to newTunFromFd

Check failure on line 29 in overlay/tun.go

View workflow job for this annotation

GitHub Actions / Build and test on linux with boringcrypto

not enough arguments in call to newTunFromFd

Check failure on line 29 in overlay/tun.go

View workflow job for this annotation

GitHub Actions / Build and test on macos-11

not enough arguments in call to newTunFromFd
}
}

func getAllRoutesFromConfig(c *config.C, cidr *net.IPNet, initial bool) (bool, []Route, error) {
if !initial && !c.HasChanged("tun.routes") && !c.HasChanged("tun.unsafe_routes") {
return false, nil, nil
}

unsafeRoutes, err := parseUnsafeRoutes(c, tunCidr)
if err != nil {
return nil, util.NewContextualError("Could not parse tun.unsafe_routes", nil, err)
routes, err := parseRoutes(c, cidr)
if err != nil {
return true, nil, util.NewContextualError("Could not parse tun.routes", nil, err)
}

unsafeRoutes, err := parseUnsafeRoutes(c, cidr)
if err != nil {
return true, nil, util.NewContextualError("Could not parse tun.unsafe_routes", nil, err)
}

routes = append(routes, unsafeRoutes...)
return true, routes, nil
}

func findRemovedRoutes(newRoutes, oldRoutes []Route) []Route {
var removed []Route
has := func(entry Route) bool {
for _, check := range newRoutes {
if check.Equal(entry) {
return true
}
}
routes = append(routes, unsafeRoutes...)
return newTunFromFd(
l,
*fd,
tunCidr,
c.GetInt("tun.mtu", DefaultMTU),
routes,
c.GetInt("tun.tx_queue", 500),
c.GetBool("tun.use_system_route_table", false),
)
return false
}

for _, oldEntry := range oldRoutes {
if !has(oldEntry) {
removed = append(removed, oldEntry)
}
}

return removed
}
Loading
Loading