2021-09-05 14:49:38 +02:00
|
|
|
//go:build !ooni_psiphon_config
|
2021-04-02 17:36:06 +02:00
|
|
|
|
|
|
|
package engine
|
|
|
|
|
2021-04-05 12:02:35 +02:00
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"errors"
|
|
|
|
)
|
2021-04-02 17:36:06 +02:00
|
|
|
|
|
|
|
// FetchPsiphonConfig fetches psiphon config from the API.
|
|
|
|
func (s *Session) FetchPsiphonConfig(ctx context.Context) ([]byte, error) {
|
|
|
|
clnt, err := s.NewOrchestraClient(ctx)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return clnt.FetchPsiphonConfig(ctx)
|
|
|
|
}
|
2021-04-05 12:02:35 +02:00
|
|
|
|
|
|
|
// sessionTunnelEarlySession is the early session that we pass
|
|
|
|
// to tunnel.Start to fetch the Psiphon configuration.
|
|
|
|
type sessionTunnelEarlySession struct{}
|
|
|
|
|
2021-04-05 19:51:41 +02:00
|
|
|
// errPsiphonNoEmbeddedConfig indicates that there is no
|
|
|
|
// embedded psiphong config file in this binary.
|
|
|
|
var errPsiphonNoEmbeddedConfig = errors.New("no embedded configuration file")
|
|
|
|
|
2021-04-05 12:02:35 +02:00
|
|
|
// FetchPsiphonConfig implements tunnel.Session.FetchPsiphonConfig.
|
|
|
|
func (s *sessionTunnelEarlySession) FetchPsiphonConfig(ctx context.Context) ([]byte, error) {
|
2021-04-05 19:51:41 +02:00
|
|
|
return nil, errPsiphonNoEmbeddedConfig
|
2021-04-05 12:02:35 +02:00
|
|
|
}
|
2021-11-19 12:40:10 +01:00
|
|
|
|
|
|
|
// CheckEmbeddedPsiphonConfig checks whether we can load psiphon's config
|
|
|
|
func CheckEmbeddedPsiphonConfig() error {
|
|
|
|
return nil
|
|
|
|
}
|