Skip to content
Draft
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: 1 addition & 1 deletion internal/engine/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ func NewSession(ctx context.Context, config SessionConfig) (*Session, error) {
Logger: config.Logger,
Name: proxyURL.Scheme,
SnowflakeRendezvous: config.SnowflakeRendezvous,
Session: &sessionTunnelEarlySession{},
Session: &SessionTunnelEarlySession{},
TorArgs: config.TorArgs,
TorBinary: config.TorBinary,
TunnelDir: config.TunnelDir,
Expand Down
6 changes: 3 additions & 3 deletions internal/engine/session_nopsiphon.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,16 @@ func (s *Session) FetchPsiphonConfig(ctx context.Context) ([]byte, error) {
return clnt.FetchPsiphonConfig(ctx)
}

// sessionTunnelEarlySession is the early session that we pass
// SessionTunnelEarlySession is the early session that we pass
// to tunnel.Start to fetch the Psiphon configuration.
type sessionTunnelEarlySession struct{}
type SessionTunnelEarlySession struct{}

// errPsiphonNoEmbeddedConfig indicates that there is no
// embedded psiphong config file in this binary.
var errPsiphonNoEmbeddedConfig = errors.New("no embedded configuration file")

// FetchPsiphonConfig implements tunnel.Session.FetchPsiphonConfig.
func (s *sessionTunnelEarlySession) FetchPsiphonConfig(ctx context.Context) ([]byte, error) {
func (s *SessionTunnelEarlySession) FetchPsiphonConfig(ctx context.Context) ([]byte, error) {
return nil, errPsiphonNoEmbeddedConfig
}

Expand Down
2 changes: 1 addition & 1 deletion internal/engine/session_nopsiphon_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
)

func TestEarlySessionNoPsiphonFetchPsiphonConfig(t *testing.T) {
s := &sessionTunnelEarlySession{}
s := &SessionTunnelEarlySession{}
out, err := s.FetchPsiphonConfig(context.Background())
if !errors.Is(err, errPsiphonNoEmbeddedConfig) {
t.Fatal("not the error we expected", err)
Expand Down
10 changes: 5 additions & 5 deletions internal/engine/session_psiphon.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ var psiphonConfigJSONAge []byte
//go:embed psiphon-config.key
var psiphonConfigSecretKey string

// sessionTunnelEarlySession is the early session that we pass
// SessionTunnelEarlySession is the early session that we pass
// to tunnel.Start to fetch the Psiphon configuration.
type sessionTunnelEarlySession struct{}
type SessionTunnelEarlySession struct{}

// FetchPsiphonConfig decrypts psiphonConfigJSONAge using
// filippo.io/age _and_ psiphonConfigSecretKey.
func (s *sessionTunnelEarlySession) FetchPsiphonConfig(ctx context.Context) ([]byte, error) {
func (s *SessionTunnelEarlySession) FetchPsiphonConfig(ctx context.Context) ([]byte, error) {
key := "AGE-SECRET-KEY-1" + psiphonConfigSecretKey
identity, err := age.ParseX25519Identity(key)
if err != nil {
Expand All @@ -40,13 +40,13 @@ func (s *sessionTunnelEarlySession) FetchPsiphonConfig(ctx context.Context) ([]b
// FetchPsiphonConfig decrypts psiphonConfigJSONAge using
// filippo.io/age _and_ psiphonConfigSecretKey.
func (s *Session) FetchPsiphonConfig(ctx context.Context) ([]byte, error) {
child := &sessionTunnelEarlySession{}
child := &SessionTunnelEarlySession{}
return child.FetchPsiphonConfig(ctx)
}

// CheckEmbeddedPsiphonConfig checks whether we can load psiphon's config
func CheckEmbeddedPsiphonConfig() error {
child := &sessionTunnelEarlySession{}
child := &SessionTunnelEarlySession{}
_, err := child.FetchPsiphonConfig(context.Background())
return err
}
Loading