Compare commits

...

1 Commits

Author SHA1 Message Date
Quentin McGaw
801c9a3086 wip 2024-11-08 16:52:47 +00:00
4 changed files with 52 additions and 7 deletions

View File

@@ -66,6 +66,33 @@ jobs:
- name: Build final image
run: docker build -t final-image .
- name: Run Wireguard
if: |
github.repository == 'qdm12/gluetun' &&
(
github.event_name == 'push' ||
(github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository)
)
run: |
docker run -it --rm --cap-add=NET_ADMIN -e VPNSP=mullvad -e VPN_TYPE=wireguard \
-e WIREGUARD_PRIVATE_KEY=${{ secrets.WIREGUARD_PRIVATE_KEY }} \
-e WIREGUARD_ADDRESS=${{ secrets.WIREGUARD_ADDRESS }} \
final-image \
exit-once-connected
- name: Run OpenVPN
if: |
github.repository == 'qdm12/gluetun' &&
(
github.event_name == 'push' ||
(github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository)
)
run: |
docker run -it --rm --cap-add=NET_ADMIN -e VPNSP=mullvad -e VPN_TYPE=openvpn \
-e OPENVPN_PASSWORD=${{ secrets.OPENVPN_PASSWORD }} \
final-image \
exit-once-connected
codeql:
runs-on: ubuntu-latest
permissions:

View File

@@ -145,6 +145,7 @@ func _main(ctx context.Context, buildInfo models.BuildInformation,
tun Tun, netLinker netLinker, cmder RunStarter,
cli clier,
) error {
var exitOnceConnected bool
if len(args) > 1 { // cli operation
switch args[1] {
case "healthcheck":
@@ -159,6 +160,8 @@ func _main(ctx context.Context, buildInfo models.BuildInformation,
return cli.FormatServers(args[2:])
case "genkey":
return cli.GenKey(args[2:])
case "exit-once-connected":
exitOnceConnected = true
default:
return fmt.Errorf("%w: %s", errCommandUnknown, args[1])
}
@@ -477,7 +480,8 @@ func _main(ctx context.Context, buildInfo models.BuildInformation,
controlGroupHandler.Add(httpServerHandler)
healthLogger := logger.New(log.SetComponent("healthcheck"))
healthcheckServer := healthcheck.NewServer(allSettings.Health, healthLogger, vpnLooper)
healthcheckServer := healthcheck.NewServer(allSettings.Health, healthLogger, vpnLooper,
exitOnceConnected)
healthServerHandler, healthServerCtx, healthServerDone := goshutdown.NewGoRoutineHandler(
"HTTP health server", goroutine.OptionTimeout(defaultShutdownTimeout))
go healthcheckServer.Run(healthServerCtx, healthServerDone)

View File

@@ -9,15 +9,16 @@ import (
)
type Server struct {
logger Logger
handler *handler
dialer *net.Dialer
config settings.Health
vpn vpnHealth
logger Logger
handler *handler
dialer *net.Dialer
config settings.Health
vpn vpnHealth
exitOnceConnected bool
}
func NewServer(config settings.Health,
logger Logger, vpnLoop StatusApplier,
logger Logger, vpnLoop StatusApplier, exitOnceConnected bool,
) *Server {
return &Server{
logger: logger,

View File

@@ -0,0 +1,13 @@
package netlink
import (
"testing"
"github.com/qdm12/log"
)
func Test_IsIPv6Supported(t *testing.T) {
n := New(log.New(log.SetLevel(log.LevelDebug)))
supported, err := n.IsIPv6Supported()
t.Log(supported, err)
}