mirror of
				https://github.com/TeaOSLab/EdgeAPI.git
				synced 2025-11-04 07:50:25 +08:00 
			
		
		
		
	集群健康检查URL中可以输入主机名
This commit is contained in:
		@@ -1,6 +1,7 @@
 | 
				
			|||||||
package tasks
 | 
					package tasks
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import (
 | 
					import (
 | 
				
			||||||
 | 
						"context"
 | 
				
			||||||
	"crypto/tls"
 | 
						"crypto/tls"
 | 
				
			||||||
	"encoding/json"
 | 
						"encoding/json"
 | 
				
			||||||
	"github.com/TeaOSLab/EdgeAPI/internal/db/models"
 | 
						"github.com/TeaOSLab/EdgeAPI/internal/db/models"
 | 
				
			||||||
@@ -10,6 +11,7 @@ import (
 | 
				
			|||||||
	"github.com/iwind/TeaGo/lists"
 | 
						"github.com/iwind/TeaGo/lists"
 | 
				
			||||||
	"github.com/iwind/TeaGo/logs"
 | 
						"github.com/iwind/TeaGo/logs"
 | 
				
			||||||
	"github.com/iwind/TeaGo/types"
 | 
						"github.com/iwind/TeaGo/types"
 | 
				
			||||||
 | 
						"net"
 | 
				
			||||||
	"net/http"
 | 
						"net/http"
 | 
				
			||||||
	"strconv"
 | 
						"strconv"
 | 
				
			||||||
	"strings"
 | 
						"strings"
 | 
				
			||||||
@@ -176,6 +178,13 @@ func (this *HealthCheckExecutor) checkNode(healthCheckConfig *serverconfigs.Heal
 | 
				
			|||||||
	client := &http.Client{
 | 
						client := &http.Client{
 | 
				
			||||||
		Timeout: timeout,
 | 
							Timeout: timeout,
 | 
				
			||||||
		Transport: &http.Transport{
 | 
							Transport: &http.Transport{
 | 
				
			||||||
 | 
								DialContext: func(ctx context.Context, network, addr string) (net.Conn, error) {
 | 
				
			||||||
 | 
									_, port, err := net.SplitHostPort(addr)
 | 
				
			||||||
 | 
									if err != nil {
 | 
				
			||||||
 | 
										return nil, err
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
									return net.Dial(network, result.NodeAddr+":"+port)
 | 
				
			||||||
 | 
								},
 | 
				
			||||||
			MaxIdleConns:          1,
 | 
								MaxIdleConns:          1,
 | 
				
			||||||
			MaxIdleConnsPerHost:   1,
 | 
								MaxIdleConnsPerHost:   1,
 | 
				
			||||||
			MaxConnsPerHost:       1,
 | 
								MaxConnsPerHost:       1,
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user