mirror of
https://github.com/v2fly/v2ray-core.git
synced 2024-11-16 09:26:21 -05:00
Merge branch 'master' of https://github.com/v2ray/v2ray-core
This commit is contained in:
commit
237ccf505c
@ -10,7 +10,7 @@ import (
|
|||||||
"v2ray.com/core/transport/ray"
|
"v2ray.com/core/transport/ray"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Handler is an outbound connection that sliently swallow the entire payload.
|
// Handler is an outbound connection that silently swallow the entire payload.
|
||||||
type Handler struct {
|
type Handler struct {
|
||||||
response ResponseConfig
|
response ResponseConfig
|
||||||
}
|
}
|
||||||
|
@ -48,7 +48,7 @@ func Dial(ctx context.Context, dest v2net.Destination) (internet.Connection, err
|
|||||||
if tcpSettings.HeaderSettings != nil {
|
if tcpSettings.HeaderSettings != nil {
|
||||||
headerConfig, err := tcpSettings.HeaderSettings.GetInstance()
|
headerConfig, err := tcpSettings.HeaderSettings.GetInstance()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.Base(err).Message("Interent|TCP: Failed to get header settings.")
|
return nil, errors.Base(err).Message("Internet|TCP: Failed to get header settings.")
|
||||||
}
|
}
|
||||||
auth, err := internet.CreateConnectionAuthenticator(headerConfig)
|
auth, err := internet.CreateConnectionAuthenticator(headerConfig)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -51,7 +51,7 @@ func ListenTCP(address v2net.Address, port v2net.Port, callback ConnectionHandle
|
|||||||
}
|
}
|
||||||
listener, err := listenFunc(address, port, options)
|
listener, err := listenFunc(address, port, options)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.Base(err).Message("Interent|TCPHub: Failed to listen on address: ", address, ":", port)
|
return nil, errors.Base(err).Message("Internet|TCPHub: Failed to listen on address: ", address, ":", port)
|
||||||
}
|
}
|
||||||
|
|
||||||
hub := &TCPHub{
|
hub := &TCPHub{
|
||||||
|
21
v2ray.go
21
v2ray.go
@ -8,6 +8,8 @@ import (
|
|||||||
"v2ray.com/core/app/dns"
|
"v2ray.com/core/app/dns"
|
||||||
"v2ray.com/core/app/log"
|
"v2ray.com/core/app/log"
|
||||||
"v2ray.com/core/app/proxyman"
|
"v2ray.com/core/app/proxyman"
|
||||||
|
"v2ray.com/core/common"
|
||||||
|
"v2ray.com/core/common/errors"
|
||||||
"v2ray.com/core/common/net"
|
"v2ray.com/core/common/net"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -59,15 +61,14 @@ func NewPoint(config *Config) (*Point, error) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
logger := log.FromSpace(space)
|
if log.FromSpace(space) == nil {
|
||||||
if logger == nil {
|
|
||||||
l, err := app.CreateAppFromConfig(ctx, &log.Config{
|
l, err := app.CreateAppFromConfig(ctx, &log.Config{
|
||||||
ErrorLogType: log.LogType_Console,
|
ErrorLogType: log.LogType_Console,
|
||||||
ErrorLogLevel: log.LogLevel_Warning,
|
ErrorLogLevel: log.LogLevel_Warning,
|
||||||
AccessLogType: log.LogType_None,
|
AccessLogType: log.LogType_None,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, errors.Base(err).Message("Core: Failed apply default log settings.")
|
||||||
}
|
}
|
||||||
space.AddApplication(l)
|
space.AddApplication(l)
|
||||||
}
|
}
|
||||||
@ -78,7 +79,9 @@ func NewPoint(config *Config) (*Point, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
space.AddApplication(o)
|
if err := space.AddApplication(o); err != nil {
|
||||||
|
return nil, errors.Base(err).Message("Core: Failed to add default outbound handler manager.")
|
||||||
|
}
|
||||||
outboundHandlerManager = o.(proxyman.OutboundHandlerManager)
|
outboundHandlerManager = o.(proxyman.OutboundHandlerManager)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -88,12 +91,13 @@ func NewPoint(config *Config) (*Point, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
space.AddApplication(o)
|
if err := space.AddApplication(o); err != nil {
|
||||||
|
return nil, errors.Base(err).Message("Core: Failed to add default inbound handler manager.")
|
||||||
|
}
|
||||||
inboundHandlerManager = o.(proxyman.InboundHandlerManager)
|
inboundHandlerManager = o.(proxyman.InboundHandlerManager)
|
||||||
}
|
}
|
||||||
|
|
||||||
dnsServer := dns.FromSpace(space)
|
if dns.FromSpace(space) == nil {
|
||||||
if dnsServer == nil {
|
|
||||||
dnsConfig := &dns.Config{
|
dnsConfig := &dns.Config{
|
||||||
NameServers: []*net.Endpoint{{
|
NameServers: []*net.Endpoint{{
|
||||||
Address: net.NewIPOrDomain(net.LocalHostDomain),
|
Address: net.NewIPOrDomain(net.LocalHostDomain),
|
||||||
@ -103,8 +107,7 @@ func NewPoint(config *Config) (*Point, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
space.AddApplication(d)
|
common.Must(space.AddApplication(d))
|
||||||
dnsServer = d.(dns.Server)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
disp := dispatcher.FromSpace(space)
|
disp := dispatcher.FromSpace(space)
|
||||||
|
Loading…
Reference in New Issue
Block a user