Documentation
¶
Index ¶
- Constants
- Variables
- type Bind
- func (*Bind) BatchSize() int
- func (b *Bind) Close() error
- func (b *Bind) GetDevice() *device.Device
- func (b *Bind) NewPeerConnection(cfg webrtc.Configuration) (*webrtc.PeerConnection, error)
- func (b *Bind) Open(port uint16) (fns []conn.ReceiveFunc, actualPort uint16, err error)
- func (b *Bind) ParseEndpoint(s string) (conn.Endpoint, error)
- func (b *Bind) Receive(ep conn.Endpoint, buf []byte) bool
- func (*Bind) Send(bufs [][]byte, ep conn.Endpoint) error
- func (b *Bind) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (b *Bind) SetLogger(logger *slog.Logger)
- func (*Bind) SetMark(mark uint32) error
- func (b *Bind) SetName(name string)
- type Config
- type Endpoint
- type HandshakeInitiation
- type HandshakeResponse
- type Inbound
- type Outbound
- type Packet
- type Peer
- type PeerEndpiontRedirected
- type PeerHandshakeHook
- type PeerMode
- type PeerPubkey
- type TransportMode
- type WireGuardMessageType
Constants ¶
View Source
const ( WsStatusBase websocket.StatusCode = 3000 WsStatusBadRequest = WsStatusBase + http.StatusBadRequest WsStatusNotAcceptable = WsStatusBase + http.StatusNotAcceptable WsStatusTemporaryRedirect = WsStatusBase + http.StatusTemporaryRedirect WsStatusPermanentRedirect = WsStatusBase + http.StatusPermanentRedirect WsStatusClientClosed = WsStatusBase + 499 )
View Source
const BatchSize = 1
View Source
const MTU = 2400 - 80
Variables ¶
View Source
var ErrEndpointImpl = errors.New("endpoint is not wgortc.Endpoint")
View Source
var ErrNoDataChannel = errors.New("no available data channel")
View Source
var ErrWSCDrop = errors.New("drop data when ws transport disabled")
View Source
var ErrWebRTCDisabled = errors.New("drop data when ws transport disabled")
View Source
var WsAcceptOptions = &websocket.AcceptOptions{ OriginPatterns: []string{"*"}, Subprotocols: []string{magicStr}, }
Functions ¶
This section is empty.
Types ¶
type Bind ¶
func (*Bind) NewPeerConnection ¶
func (b *Bind) NewPeerConnection(cfg webrtc.Configuration) (*webrtc.PeerConnection, error)
type Endpoint ¶
type Endpoint struct {
// contains filtered or unexported fields
}
func (*Endpoint) DstToBytes ¶
func (*Endpoint) DstToString ¶
func (*Endpoint) SrcToString ¶
type HandshakeInitiation ¶
type HandshakeInitiation struct {
Initiator []byte `json:"initiator"`
Extra json.RawMessage `json:"extra"`
}
type HandshakeResponse ¶
type HandshakeResponse struct {
TransportMode uint32 `json:"transport_mode"`
Extra json.RawMessage `json:"extra"`
}
type Peer ¶
type Peer interface {
GetID() string // 用以辨别节点
GetPeerInit() webrtc.Configuration
}
type PeerEndpiontRedirected ¶ added in v0.5.0
type PeerHandshakeHook ¶ added in v0.8.0
type PeerHandshakeHook interface {
HandshakeInitiationHook(initiator *HandshakeInitiation)
HandshakeResponseHook(hresp *HandshakeResponse)
HandshakedHook(ep conn.Endpoint)
}
type PeerMode ¶ added in v0.3.0
type PeerMode interface {
TransportMode() TransportMode
}
type PeerPubkey ¶ added in v0.7.0
type PeerPubkey interface {
GetPubkey() device.NoisePublicKey
}
type TransportMode ¶ added in v0.3.0
type TransportMode uint32
const ( WSTransportDisabled TransportMode = 1 << (iota + 1) WebRTCTransportDisabled WSRedirectEnabled )
const (
AllTransportDisabled TransportMode = WSTransportDisabled | WebRTCTransportDisabled
)
type WireGuardMessageType ¶
type WireGuardMessageType = uint8
const ( WireGuardMessageInitiator WireGuardMessageType = iota + 1 WireGuardMessageResponder WireGuardMessageData )
Source Files
¶
Click to show internal directories.
Click to hide internal directories.