Documentation
¶
Overview ¶
internal/network/connectivity.go
internal/network/discovery.go
internal/network/onboarding.go
internal/network/tunnel.go
Index ¶
- func IsProviderReady(provider string) bool
- func SaveTunnelInfo(projectName string, info *TunnelInfo) error
- type CloudflareTunnel
- type ConnectionInfo
- type ConnectivityManager
- func (cm *ConnectivityManager) GetConnectionInfo() (*ConnectionInfo, error)
- func (cm *ConnectivityManager) GetMobileConfig() (*MobileConfig, error)
- func (cm *ConnectivityManager) RegisterService(name string, port int)
- func (cm *ConnectivityManager) Start(ctx context.Context) error
- func (cm *ConnectivityManager) Stop() error
- func (cm *ConnectivityManager) TestConnectivity(url string) (*ConnectivityTest, error)
- type ConnectivityTest
- type MobileConfig
- type MobileEndpoint
- type NetworkDiscovery
- func (n *NetworkDiscovery) DiscoverServices(timeout time.Duration) ([]ServiceInfo, error)
- func (n *NetworkDiscovery) GetLocalIPs() ([]string, error)
- func (n *NetworkDiscovery) GetNetworkURLs(projectName string, services map[string]int) (map[string][]string, error)
- func (n *NetworkDiscovery) StartMDNS(projectName string, services map[string]int) error
- func (n *NetworkDiscovery) StopMDNS()
- type NgrokTunnel
- type ServiceInfo
- type TunnelInfo
- type TunnelManager
- type TunnelOnboarding
- type TunnelProvider
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsProviderReady ¶
IsProviderReady checks if a specific provider is ready to use
func SaveTunnelInfo ¶
func SaveTunnelInfo(projectName string, info *TunnelInfo) error
SaveTunnelInfo saves tunnel information to disk
Types ¶
type CloudflareTunnel ¶
type CloudflareTunnel struct {
// contains filtered or unexported fields
}
CloudflareTunnel implementation
func NewCloudflareTunnel ¶
func NewCloudflareTunnel(cfg *config.TunnelConfig) (*CloudflareTunnel, error)
NewCloudflareTunnel creates a new Cloudflare tunnel provider
func (*CloudflareTunnel) Disconnect ¶
func (ct *CloudflareTunnel) Disconnect() error
Disconnect stops the Cloudflare tunnel
func (*CloudflareTunnel) GetProviderName ¶
func (ct *CloudflareTunnel) GetProviderName() string
GetProviderName returns "cloudflare"
func (*CloudflareTunnel) GetURL ¶
func (ct *CloudflareTunnel) GetURL() string
GetURL returns the tunnel URL
func (*CloudflareTunnel) IsPersistent ¶
func (ct *CloudflareTunnel) IsPersistent() bool
IsPersistent returns true if using named tunnel
type ConnectionInfo ¶
type ConnectionInfo struct {
ProjectName string `json:"project_name"`
Status string `json:"status"`
LocalURLs map[string]string `json:"local_urls"`
NetworkURLs map[string][]string `json:"network_urls"`
MDNSURLs map[string]string `json:"mdns_urls"`
TunnelURLs map[string]string `json:"tunnel_urls"`
GeneratedAt time.Time `json:"generated_at"`
}
ConnectionInfo represents all connection information
type ConnectivityManager ¶
type ConnectivityManager struct {
// contains filtered or unexported fields
}
ConnectivityManager manages all connectivity features
func NewConnectivityManager ¶
func NewConnectivityManager(cfg *config.Config) (*ConnectivityManager, error)
NewConnectivityManager creates a new connectivity manager
func (*ConnectivityManager) GetConnectionInfo ¶
func (cm *ConnectivityManager) GetConnectionInfo() (*ConnectionInfo, error)
GetConnectionInfo returns all connection information
func (*ConnectivityManager) GetMobileConfig ¶
func (cm *ConnectivityManager) GetMobileConfig() (*MobileConfig, error)
GetMobileConfig returns configuration for mobile apps
func (*ConnectivityManager) RegisterService ¶
func (cm *ConnectivityManager) RegisterService(name string, port int)
RegisterService registers a service port
func (*ConnectivityManager) Start ¶
func (cm *ConnectivityManager) Start(ctx context.Context) error
Start starts all connectivity services
func (*ConnectivityManager) Stop ¶
func (cm *ConnectivityManager) Stop() error
Stop stops all connectivity services
func (*ConnectivityManager) TestConnectivity ¶
func (cm *ConnectivityManager) TestConnectivity(url string) (*ConnectivityTest, error)
TestConnectivity tests connectivity to a URL
type ConnectivityTest ¶
type ConnectivityTest struct {
URL string `json:"url"`
Success bool `json:"success"`
HTTPStatus string `json:"http_status"`
HTTPLatency time.Duration `json:"http_latency"`
WebSocketStatus string `json:"websocket_status"`
Error string `json:"error,omitempty"`
TestedAt time.Time `json:"tested_at"`
}
ConnectivityTest represents a connectivity test result
type MobileConfig ¶
type MobileConfig struct {
ProjectName string `json:"project_name"`
UpdatedAt time.Time `json:"updated_at"`
Endpoints map[string]MobileEndpoint `json:"endpoints"`
EnvFormat string `json:"env_format"`
}
MobileConfig represents configuration for mobile apps
func (*MobileConfig) ToJSON ¶
func (mc *MobileConfig) ToJSON() (string, error)
ToJSON returns JSON representation
type MobileEndpoint ¶
type MobileEndpoint struct {
Primary string `json:"primary"` // The URL to use
Local string `json:"local"` // localhost URL
Network string `json:"network"` // LAN IP URL
Public string `json:"public"` // Tunnel URL
WebSocket string `json:"websocket"` // WebSocket URL
}
MobileEndpoint represents an endpoint configuration
type NetworkDiscovery ¶
type NetworkDiscovery struct {
// contains filtered or unexported fields
}
NetworkDiscovery handles local network discovery and mDNS
func NewNetworkDiscovery ¶
func NewNetworkDiscovery() *NetworkDiscovery
NewNetworkDiscovery creates a new network discovery instance
func (*NetworkDiscovery) DiscoverServices ¶
func (n *NetworkDiscovery) DiscoverServices(timeout time.Duration) ([]ServiceInfo, error)
DiscoverServices discovers other LocalCloud services on the network
func (*NetworkDiscovery) GetLocalIPs ¶
func (n *NetworkDiscovery) GetLocalIPs() ([]string, error)
GetLocalIPs returns all valid local IP addresses
func (*NetworkDiscovery) GetNetworkURLs ¶
func (n *NetworkDiscovery) GetNetworkURLs(projectName string, services map[string]int) (map[string][]string, error)
GetNetworkURLs returns all possible network URLs for services
func (*NetworkDiscovery) StartMDNS ¶
func (n *NetworkDiscovery) StartMDNS(projectName string, services map[string]int) error
StartMDNS starts mDNS service advertisement
func (*NetworkDiscovery) StopMDNS ¶
func (n *NetworkDiscovery) StopMDNS()
StopMDNS stops the mDNS server
type NgrokTunnel ¶
type NgrokTunnel struct {
// contains filtered or unexported fields
}
NgrokTunnel implementation
func NewNgrokTunnel ¶
func NewNgrokTunnel(cfg *config.TunnelConfig) (*NgrokTunnel, error)
NewNgrokTunnel creates a new Ngrok tunnel provider
func (*NgrokTunnel) Disconnect ¶
func (nt *NgrokTunnel) Disconnect() error
Disconnect stops the Ngrok tunnel
func (*NgrokTunnel) GetProviderName ¶
func (nt *NgrokTunnel) GetProviderName() string
GetProviderName returns "ngrok"
func (*NgrokTunnel) IsPersistent ¶
func (nt *NgrokTunnel) IsPersistent() bool
IsPersistent returns true if using custom domain
type ServiceInfo ¶
ServiceInfo represents discovered service information
func (ServiceInfo) ParseTxtData ¶
func (s ServiceInfo) ParseTxtData() map[string]string
ParseTxtData parses TXT record data into a map
type TunnelInfo ¶
type TunnelInfo struct {
Provider string `json:"provider"`
URL string `json:"url"`
TunnelID string `json:"tunnel_id,omitempty"`
Domain string `json:"domain,omitempty"`
CreatedAt time.Time `json:"created_at"`
LastStarted time.Time `json:"last_started"`
}
TunnelInfo represents tunnel information for persistence
func LoadTunnelInfo ¶
func LoadTunnelInfo(projectName string) (*TunnelInfo, error)
LoadTunnelInfo loads tunnel information from disk
type TunnelManager ¶
type TunnelManager struct {
// contains filtered or unexported fields
}
TunnelManager manages tunnel connections
func NewTunnelManager ¶
func NewTunnelManager(cfg *config.ConnectivityConfig) (*TunnelManager, error)
NewTunnelManager creates a new tunnel manager
func (*TunnelManager) Disconnect ¶
func (tm *TunnelManager) Disconnect() error
Disconnect closes the tunnel
func (*TunnelManager) GetProviderName ¶
func (tm *TunnelManager) GetProviderName() string
GetProviderName returns the active provider name
func (*TunnelManager) GetURL ¶
func (tm *TunnelManager) GetURL() string
GetURL returns the current tunnel URL
type TunnelOnboarding ¶
type TunnelOnboarding struct {
// contains filtered or unexported fields
}
TunnelOnboarding handles first-time tunnel setup
func NewTunnelOnboarding ¶
func NewTunnelOnboarding() *TunnelOnboarding
NewTunnelOnboarding creates a new onboarding helper
func (*TunnelOnboarding) CheckAndSetup ¶
func (t *TunnelOnboarding) CheckAndSetup() (string, error)
CheckAndSetup checks if tunnel provider is ready and sets it up if needed
func (*TunnelOnboarding) GetConfiguredProvider ¶
func (t *TunnelOnboarding) GetConfiguredProvider() string
GetConfiguredProvider returns the configured provider after onboarding