Skip to content

Commit

Permalink
psiphon: store cache files in correct location
Browse files Browse the repository at this point in the history
Signed-off-by: Mark Pashmfouroush <[email protected]>
  • Loading branch information
markpash committed May 5, 2024
1 parent 515cb28 commit 23d7929
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 20 deletions.
2 changes: 1 addition & 1 deletion app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ func runWarpWithPsiphon(ctx context.Context, l *slog.Logger, opts WarpOptions, e
}

// run psiphon
err = psiphon.RunPsiphon(ctx, l.With("subsystem", "psiphon"), warpBind.String(), opts.Bind.String(), opts.Psiphon.Country)
err = psiphon.RunPsiphon(ctx, l.With("subsystem", "psiphon"), warpBind.String(), opts.CacheDir, opts.Bind.String(), opts.Psiphon.Country)
if err != nil {
return fmt.Errorf("unable to run psiphon %w", err)
}
Expand Down
21 changes: 2 additions & 19 deletions psiphon/p.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,6 @@ func StartTunnel(
configJSON []byte,
embeddedServerEntryList string,
params Parameters,
paramsDelta ParametersDelta,
noticeReceiver func(NoticeEvent),
) (retTunnel *Tunnel, retErr error) {
config, err := psiphon.LoadConfig(configJSON)
if err != nil {
Expand Down Expand Up @@ -147,14 +145,6 @@ func StartTunnel(
return nil, errors.New("config.Commit failed")
}

// If supplied, apply the parameters delta
if len(paramsDelta) > 0 {
err = config.SetParameters("", false, paramsDelta)
if err != nil {
return nil, fmt.Errorf("set parameters failed for delta %v : %w", paramsDelta, err)
}
}

// Will receive a value when the tunnel has successfully connected.
connected := make(chan struct{}, 1)
// Will receive a value if an error occurs during the connection sequence.
Expand Down Expand Up @@ -199,12 +189,6 @@ func StartTunnel(
}
}
}

// Some users of this package may need to add special processing of notices.
// If the caller has requested it, we'll pass on the notices.
if noticeReceiver != nil {
noticeReceiver(event)
}
}))

err = psiphon.OpenDataStore(config)
Expand Down Expand Up @@ -316,7 +300,7 @@ func (tunnel *Tunnel) Stop() {
psiphon.CloseDataStore()
}

func RunPsiphon(ctx context.Context, l *slog.Logger, wgBind, localSocksPort, country string) error {
func RunPsiphon(ctx context.Context, l *slog.Logger, wgBind, dir, localSocksPort, country string) error {
// Embedded configuration
host, port, err := net.SplitHostPort(localSocksPort)
if err != nil {
Expand All @@ -342,7 +326,6 @@ func RunPsiphon(ctx context.Context, l *slog.Logger, wgBind, localSocksPort, cou
"AllowDefaultDNSResolverWithBindToDevice":true
}`

dir := "."
ClientPlatform := "Android_4.0.4_com.example.exampleClientLibraryApp"
network := "test"
timeout := 60
Expand Down Expand Up @@ -371,7 +354,7 @@ func RunPsiphon(ctx context.Context, l *slog.Logger, wgBind, localSocksPort, cou
}
return errors.New("psiphon handshake maximum time exceeded")
case <-t.C:
tunnel, err := StartTunnel(ctx, []byte(configJSON), "", p, nil, nil)
tunnel, err := StartTunnel(ctx, []byte(configJSON), "", p)
if err != nil {
l.Info("Unable to start psiphon", err, "reconnecting...")
continue
Expand Down

0 comments on commit 23d7929

Please sign in to comment.