mirror of
https://github.com/v2fly/v2ray-core.git
synced 2025-01-17 23:06:30 -05:00
comments
This commit is contained in:
parent
98e330513d
commit
cb8e7dc9a0
@ -310,10 +310,12 @@ func NewServer(ctx context.Context) *Server {
|
||||
return s
|
||||
}
|
||||
|
||||
// Type implements common.HasType.
|
||||
func (s *Server) Type() interface{} {
|
||||
return s.dispatcher.Type()
|
||||
}
|
||||
|
||||
// Dispatch impliments routing.Dispatcher
|
||||
func (s *Server) Dispatch(ctx context.Context, dest net.Destination) (*vio.Link, error) {
|
||||
if dest.Address != muxCoolAddress {
|
||||
return s.dispatcher.Dispatch(ctx, dest)
|
||||
|
@ -3,17 +3,18 @@ package internet
|
||||
import (
|
||||
"context"
|
||||
|
||||
"v2ray.com/core/common/session"
|
||||
|
||||
"v2ray.com/core/common/net"
|
||||
"v2ray.com/core/common/session"
|
||||
)
|
||||
|
||||
// Dialer is an interface to dial network connection to a specific destination.
|
||||
type Dialer func(ctx context.Context, dest net.Destination) (Connection, error)
|
||||
|
||||
var (
|
||||
transportDialerCache = make(map[string]Dialer)
|
||||
)
|
||||
|
||||
// RegisterTransportDialer registers a Dialer with given name.
|
||||
func RegisterTransportDialer(protocol string, dialer Dialer) error {
|
||||
if _, found := transportDialerCache[protocol]; found {
|
||||
return newError(protocol, " dialer already registered").AtError()
|
||||
|
@ -1,5 +1,6 @@
|
||||
package internet
|
||||
|
||||
// MemoryStreamConfig is a parsed form of StreamConfig. This is used to reduce number of Protobuf parsing.
|
||||
type MemoryStreamConfig struct {
|
||||
ProtocolName string
|
||||
ProtocolSettings interface{}
|
||||
@ -8,6 +9,7 @@ type MemoryStreamConfig struct {
|
||||
SocketSettings *SocketConfig
|
||||
}
|
||||
|
||||
// ToMemoryStreamConfig converts a StreamConfig to MemoryStreamConfig. It returns a default non-nil MemoryStreamConfig for nil input.
|
||||
func ToMemoryStreamConfig(s *StreamConfig) (*MemoryStreamConfig, error) {
|
||||
ets, err := s.GetEffectiveTransportSettings()
|
||||
if err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user