mirror of
https://github.com/TeaOSLab/EdgeNode.git
synced 2025-11-27 18:40:28 +08:00
[WEBSOCKET]在日志中增加详细错误提示/TLS连接增加InsecureSkipVerify选项
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
package nodes
|
package nodes
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"errors"
|
||||||
"github.com/iwind/TeaGo/logs"
|
"github.com/iwind/TeaGo/logs"
|
||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
@@ -11,6 +12,7 @@ import (
|
|||||||
func (this *HTTPRequest) doWebsocket() {
|
func (this *HTTPRequest) doWebsocket() {
|
||||||
if this.web.WebsocketRef == nil || !this.web.WebsocketRef.IsOn || this.web.Websocket == nil || !this.web.Websocket.IsOn {
|
if this.web.WebsocketRef == nil || !this.web.WebsocketRef.IsOn || this.web.Websocket == nil || !this.web.Websocket.IsOn {
|
||||||
this.writer.WriteHeader(http.StatusForbidden)
|
this.writer.WriteHeader(http.StatusForbidden)
|
||||||
|
this.addError(errors.New("websocket have not been enabled yet"))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -23,6 +25,7 @@ func (this *HTTPRequest) doWebsocket() {
|
|||||||
if err == nil {
|
if err == nil {
|
||||||
if !this.web.Websocket.MatchOrigin(u.Host) {
|
if !this.web.Websocket.MatchOrigin(u.Host) {
|
||||||
this.writer.WriteHeader(http.StatusForbidden)
|
this.writer.WriteHeader(http.StatusForbidden)
|
||||||
|
this.addError(errors.New("websocket origin '" + requestOrigin + "' not been allowed"))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,9 @@ func OriginConnect(origin *serverconfigs.OriginConfig) (net.Conn, error) {
|
|||||||
// TODO 支持指定特定网卡
|
// TODO 支持指定特定网卡
|
||||||
// TODO Addr支持端口范围,如果有多个端口时,随机一个端口使用
|
// TODO Addr支持端口范围,如果有多个端口时,随机一个端口使用
|
||||||
// TODO 支持使用证书
|
// TODO 支持使用证书
|
||||||
return tls.Dial("tcp", origin.Addr.Host+":"+origin.Addr.PortRange, &tls.Config{})
|
return tls.Dial("tcp", origin.Addr.Host+":"+origin.Addr.PortRange, &tls.Config{
|
||||||
|
InsecureSkipVerify: true,
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO 支持从Unix、Pipe、HTTP、HTTPS中读取数据
|
// TODO 支持从Unix、Pipe、HTTP、HTTPS中读取数据
|
||||||
|
|||||||
Reference in New Issue
Block a user