Documentation ¶
Index ¶
- Constants
- Variables
- func Handle(p string, handler http.Handler) string
- func PreferProxiedUI(val bool) (newAddr string, addrChanged bool)
- func Show()
- func Start(requestedAddr string, allowRemote bool, extUrl string) (string, error)
- func Unregister(t string)
- type ConnectFunc
- type Envelope
- type EnvelopeType
- type Service
- type UIChannel
Constants ¶
const (
LocalUIDir = "../../../../../../lantern-ui/app"
)
const (
// Determines the chunking size of messages used by gorilla
MaxMessageSize = 1024
)
Variables ¶
var (
Translations *tarfs.FileSystem
)
Functions ¶
func PreferProxiedUI ¶
func Show ¶
func Show()
Show opens the UI in a browser. Note we know the UI server is *listening* at this point as long as Start is correctly called prior to this method. It may not be reading yet, but since we're the only ones reading from those incoming sockets the fact that reading starts asynchronously is not a problem.
func Unregister ¶
func Unregister(t string)
Types ¶
type ConnectFunc ¶
type Envelope ¶
type Envelope struct { EnvelopeType Message interface{} `json:"message"` }
Envelope is a struct that wraps messages and associates them with a type.
type EnvelopeType ¶
type EnvelopeType struct {
Type string `json:"type,inline"`
}
type Service ¶
type Service struct { Type string In <-chan interface{} Out chan<- interface{} // contains filtered or unexported fields }
type UIChannel ¶
type UIChannel struct { URL string In <-chan []byte Out chan<- []byte // contains filtered or unexported fields }
UIChannel represents a data channel to/from the UI. UIChannel will have one underlying websocket connection for each connected browser window. All messages from any browser window are available via In and all messages sent to Out will be published to all browser windows.
func NewChannel ¶
func NewChannel(p string, onConnect ConnectFunc) *UIChannel
NewChannel establishes a new channel to the UI at the given path. When the UI connects to this path, we will establish a websocket to the UI to carry messages for this UIChannel. The given onConnect function is called anytime that the UI connects.