mirror of
https://github.com/AdguardTeam/AdGuardHome.git
synced 2024-11-26 15:05:50 +03:00
Merge branch 'master' of ssh://bit.adguard.com:7999/dns/adguard-home
This commit is contained in:
commit
fe056cfaf0
5 changed files with 16 additions and 19 deletions
|
@ -32,7 +32,7 @@ class CustomRules extends Component {
|
|||
|
||||
handleCheck = (values) => {
|
||||
this.props.checkHost(values);
|
||||
}
|
||||
};
|
||||
|
||||
render() {
|
||||
const {
|
||||
|
|
|
@ -64,7 +64,8 @@ class DnsAllowlist extends Component {
|
|||
},
|
||||
} = this.props;
|
||||
const currentFilterData = getCurrentFilter(modalFilterUrl, whitelistFilters);
|
||||
const loading = processingFilters
|
||||
const loading = processingConfigFilter
|
||||
|| processingFilters
|
||||
|| processingAddFilter
|
||||
|| processingRemoveFilter
|
||||
|| processingRefreshFilters;
|
||||
|
|
|
@ -60,7 +60,8 @@ class DnsBlocklist extends Component {
|
|||
},
|
||||
} = this.props;
|
||||
const currentFilterData = getCurrentFilter(modalFilterUrl, filters);
|
||||
const loading = processingFilters
|
||||
const loading = processingConfigFilter
|
||||
|| processingFilters
|
||||
|| processingAddFilter
|
||||
|| processingRemoveFilter
|
||||
|| processingRefreshFilters;
|
||||
|
|
|
@ -124,6 +124,11 @@ func Create(config ServerConfig) *Server {
|
|||
}
|
||||
}
|
||||
|
||||
if !webHandlersRegistered && s.conf.HTTPRegister != nil {
|
||||
webHandlersRegistered = true
|
||||
s.registerHandlers()
|
||||
}
|
||||
|
||||
// we can't delay database loading until DHCP server is started,
|
||||
// because we need static leases functionality available beforehand
|
||||
s.dbLoad()
|
||||
|
@ -219,12 +224,6 @@ func (s *Server) setConfig(config ServerConfig) error {
|
|||
|
||||
// Start will listen on port 67 and serve DHCP requests.
|
||||
func (s *Server) Start() error {
|
||||
|
||||
if !webHandlersRegistered && s.conf.HTTPRegister != nil {
|
||||
webHandlersRegistered = true
|
||||
s.registerHandlers()
|
||||
}
|
||||
|
||||
// TODO: don't close if interface and addresses are the same
|
||||
if s.conn != nil {
|
||||
_ = s.closeConn()
|
||||
|
|
|
@ -36,11 +36,6 @@ func GetValidNetInterfaces() ([]net.Interface, error) {
|
|||
netIfaces := []net.Interface{}
|
||||
|
||||
for i := range ifaces {
|
||||
if ifaces[i].Flags&net.FlagPointToPoint != 0 {
|
||||
// this interface is ppp, we're not interested in this one
|
||||
continue
|
||||
}
|
||||
|
||||
iface := ifaces[i]
|
||||
netIfaces = append(netIfaces, iface)
|
||||
}
|
||||
|
@ -48,7 +43,7 @@ func GetValidNetInterfaces() ([]net.Interface, error) {
|
|||
return netIfaces, nil
|
||||
}
|
||||
|
||||
// getValidNetInterfacesMap returns interfaces that are eligible for DNS and WEB only
|
||||
// GetValidNetInterfacesForWeb returns interfaces that are eligible for DNS and WEB only
|
||||
// we do not return link-local addresses here
|
||||
func GetValidNetInterfacesForWeb() ([]NetInterface, error) {
|
||||
ifaces, err := GetValidNetInterfaces()
|
||||
|
@ -101,7 +96,7 @@ func GetValidNetInterfacesForWeb() ([]NetInterface, error) {
|
|||
return netInterfaces, nil
|
||||
}
|
||||
|
||||
// Get interface name by its IP address.
|
||||
// GetInterfaceByIP - Get interface name by its IP address.
|
||||
func GetInterfaceByIP(ip string) string {
|
||||
ifaces, err := GetValidNetInterfacesForWeb()
|
||||
if err != nil {
|
||||
|
@ -119,7 +114,7 @@ func GetInterfaceByIP(ip string) string {
|
|||
return ""
|
||||
}
|
||||
|
||||
// Get IP address with netmask for the specified interface
|
||||
// GetSubnet - Get IP address with netmask for the specified interface
|
||||
// Returns an empty string if it fails to find it
|
||||
func GetSubnet(ifaceName string) string {
|
||||
netIfaces, err := GetValidNetInterfacesForWeb()
|
||||
|
@ -137,7 +132,7 @@ func GetSubnet(ifaceName string) string {
|
|||
return ""
|
||||
}
|
||||
|
||||
// checkPortAvailable is not a cheap test to see if the port is bindable, because it's actually doing the bind momentarily
|
||||
// CheckPortAvailable - check if TCP port is available
|
||||
func CheckPortAvailable(host string, port int) error {
|
||||
ln, err := net.Listen("tcp", net.JoinHostPort(host, strconv.Itoa(port)))
|
||||
if err != nil {
|
||||
|
@ -151,6 +146,7 @@ func CheckPortAvailable(host string, port int) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// CheckPacketPortAvailable - check if UDP port is available
|
||||
func CheckPacketPortAvailable(host string, port int) error {
|
||||
ln, err := net.ListenPacket("udp", net.JoinHostPort(host, strconv.Itoa(port)))
|
||||
if err != nil {
|
||||
|
@ -164,7 +160,7 @@ func CheckPacketPortAvailable(host string, port int) error {
|
|||
return err
|
||||
}
|
||||
|
||||
// check if error is "address already in use"
|
||||
// ErrorIsAddrInUse - check if error is "address already in use"
|
||||
func ErrorIsAddrInUse(err error) bool {
|
||||
errOpError, ok := err.(*net.OpError)
|
||||
if !ok {
|
||||
|
|
Loading…
Reference in a new issue