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

Cherry picks #68

Merged
merged 3 commits into from
Aug 30, 2024
Merged
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
2 changes: 2 additions & 0 deletions client/fsm.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ func newFSM(
Transitions: []FSMTransition{
{To: StateMain, Description: "Authorized"},
{To: StateDisconnected, Description: "Cancel, was disconnected"},
{To: StateGotConfig, Description: "Cancel, was got config"},
},
},
StateGettingConfig: FSMState{
Expand All @@ -140,6 +141,7 @@ func newFSM(
Transitions: []FSMTransition{
{To: StateGettingConfig, Description: "Get a VPN config again"},
{To: StateConnecting, Description: "VPN is connecting"},
{To: StateOAuthStarted, Description: "Renew"},
},
},
StateConnecting: FSMState{
Expand Down
3 changes: 3 additions & 0 deletions internal/api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,9 @@ func (a *API) Connect(ctx context.Context, prof profiles.Profile, protos []proto

// Parse expiry
expH := h.Get("expires")
if expH == "" {
return nil, errors.New("the server did not give an expires header")
}
expT, err := http.ParseTime(expH)
if err != nil {
return nil, fmt.Errorf("failed parsing expiry time: %w", err)
Expand Down
5 changes: 2 additions & 3 deletions internal/failover/monitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package failover

import (
"context"
"errors"
"fmt"
"time"

Expand Down Expand Up @@ -43,8 +42,8 @@ func (m *DroppedConMon) dropped(startBytes int64) (bool, error) {
// This does not check Rx bytes every tick, but rather when pAlive or pDropped is reached
// It returns an error if there was an invalid input or a ping was failed to be sent
func (m *DroppedConMon) Start(ctx context.Context, gateway string, mtuSize int) (bool, error) {
if mtuSize <= 0 {
return false, errors.New("invalid mtu size given")
if mtuSize < mtuOverhead {
return false, fmt.Errorf("invalid MTU size given, MTU has to be at least: %v bytes", mtuOverhead)
}

// Create a ping struct with our mtu size
Expand Down
Loading