Convert Figma logo to code with AI

IrineSistiana logomosdns

一个 DNS 转发器

2,827
318
2,827
71

Top Related Projects

Network-wide ads & trackers blocking DNS server

dnscrypt-proxy 2 - A flexible DNS proxy, with support for encrypted DNS protocols.

7,957

DNS library in Go

12,196

CoreDNS is a DNS server that chains plugins

Quick Overview

mosdns is a flexible DNS forwarder and resolver designed for advanced DNS routing and manipulation. It offers powerful features like custom plugins, domain-based routing, and DNS-over-HTTPS support, making it a versatile tool for network administrators and privacy-conscious users.

Pros

  • Highly customizable with a plugin system for extended functionality
  • Supports various DNS protocols including DNS-over-HTTPS and DNS-over-TLS
  • Offers advanced domain-based routing and filtering capabilities
  • Lightweight and efficient, suitable for both desktop and embedded systems

Cons

  • Steep learning curve due to its complex configuration options
  • Limited documentation, especially for advanced features
  • May require technical expertise to set up and optimize
  • Smaller community compared to more established DNS tools

Code Examples

# Basic configuration example
log:
  level: info
plugins:
  - tag: forward_google
    type: forward
    args:
      upstream:
        - addr: https://dns.google/dns-query

  - tag: main_sequence
    type: sequence
    args:
      - exec: forward_google

servers:
  - listen: 127.0.0.1:53
    protocol: udp
    entry: main_sequence

This example shows a basic mosdns configuration that forwards DNS queries to Google's DNS-over-HTTPS service.

# Domain-based routing example
plugins:
  - tag: forward_cloudflare
    type: forward
    args:
      upstream:
        - addr: https://cloudflare-dns.com/dns-query

  - tag: forward_local
    type: forward
    args:
      upstream:
        - addr: 192.168.1.1

  - tag: domain_router
    type: domain_set
    args:
      files:
        - local_domains.txt

  - tag: main_sequence
    type: sequence
    args:
      - if: query_is_domain_in domain_router
        exec: forward_local
      - exec: forward_cloudflare

servers:
  - listen: 127.0.0.1:53
    protocol: udp
    entry: main_sequence

This example demonstrates domain-based routing, where queries for domains in a local list are forwarded to a local DNS server, while others are sent to Cloudflare's DNS-over-HTTPS service.

Getting Started

  1. Download the latest mosdns release from the GitHub repository.
  2. Create a configuration file (e.g., config.yaml) with your desired settings.
  3. Run mosdns with the command: ./mosdns run -c config.yaml
  4. Configure your system or applications to use mosdns as the DNS server (typically 127.0.0.1:53).

For more advanced configurations, refer to the project's wiki and example configurations in the repository.

Competitor Comparisons

Network-wide ads & trackers blocking DNS server

Pros of AdGuardHome

  • More comprehensive DNS filtering and ad-blocking solution
  • User-friendly web interface for easy configuration
  • Supports multiple upstream DNS providers

Cons of AdGuardHome

  • Higher resource usage due to additional features
  • More complex setup process
  • Larger codebase, potentially harder to maintain

Code Comparison

AdGuardHome (Go):

func (d *DNSFilter) CheckHost(host string, qtype uint16, setts *FilteringSettings) (Result, error) {
    // Complex filtering logic
}

mosdns (Go):

func (h *Handler) Match(ctx context.Context, qCtx *query_context.Context) (bool, error) {
    // Simpler matching logic
}

Summary

AdGuardHome offers a more feature-rich DNS filtering solution with a user-friendly interface, while mosdns provides a lightweight and flexible DNS forwarding tool. AdGuardHome is better suited for users seeking a comprehensive ad-blocking and DNS management system, whereas mosdns is ideal for those who need a simple, customizable DNS forwarder with basic filtering capabilities.

dnscrypt-proxy 2 - A flexible DNS proxy, with support for encrypted DNS protocols.

Pros of dnscrypt-proxy

  • Supports a wide range of DNS protocols, including DNSCrypt, DNS-over-HTTPS, and DNS-over-TLS
  • Offers advanced features like DNS caching, load balancing, and anonymized DNS
  • Has a large user base and active community support

Cons of dnscrypt-proxy

  • Configuration can be complex for beginners
  • Limited built-in DNS filtering capabilities
  • May have higher resource usage compared to simpler DNS proxies

Code Comparison

dnscrypt-proxy (Go):

func (proxy *Proxy) exchangeWithCache(serverInfo *ServerInfo, encryptedQuery []byte, clientNonce []byte) ([]byte, error) {
    cachedResponse, err := proxy.localCache.Get(encryptedQuery)
    if err == nil {
        return cachedResponse, nil
    }
    // ... (additional code for DNS exchange)
}

mosdns (Go):

func (h *Handler) Lookup(ctx context.Context, q *dns.Msg) (*dns.Msg, error) {
    if r := h.cache.Get(q); r != nil {
        return r, nil
    }
    // ... (additional code for DNS lookup)
}

Both projects use Go and implement DNS caching, but dnscrypt-proxy focuses on encrypted DNS protocols, while mosdns provides more flexibility in DNS query handling and plugin-based architecture.

7,957

DNS library in Go

Pros of dns

  • More mature and widely adopted project with a larger community
  • Comprehensive DNS library with support for various DNS-related operations
  • Extensive documentation and examples available

Cons of dns

  • Focused solely on DNS functionality, lacking built-in DNS server features
  • Requires more setup and configuration for advanced use cases
  • May have a steeper learning curve for beginners

Code Comparison

mosdns:

package main

import "github.com/IrineSistiana/mosdns/v5/coremain"

func main() {
    coremain.Main()
}

dns:

package main

import (
    "github.com/miekg/dns"
    "net"
)

func main() {
    dns.HandleFunc(".", handleDNSRequest)
    server := &dns.Server{Addr: ":53", Net: "udp"}
    server.ListenAndServe()
}

mosdns provides a more streamlined approach for setting up a DNS server with built-in functionality, while dns offers greater flexibility but requires more manual configuration.

12,196

CoreDNS is a DNS server that chains plugins

Pros of CoreDNS

  • More mature and widely adopted project with extensive documentation
  • Highly extensible plugin architecture
  • Supports multiple DNS protocols (DNS, DoH, DoT)

Cons of CoreDNS

  • Larger codebase and potentially higher resource usage
  • Steeper learning curve for configuration and customization
  • May be overkill for simpler DNS requirements

Code Comparison

mosdns configuration example:

log:
  level: info
plugins:
  - tag: forward
    type: forward
    args:
      upstream:
        - addr: 8.8.8.8

CoreDNS configuration example:

.:53 {
    forward . 8.8.8.8
    log
    errors
}

Key Differences

  • mosdns is designed specifically for DNS manipulation and filtering
  • CoreDNS offers a more comprehensive DNS server solution
  • mosdns configuration uses YAML, while CoreDNS uses its own Corefile format
  • mosdns focuses on performance and flexibility for DNS operations
  • CoreDNS provides broader functionality beyond basic DNS serving

Both projects serve DNS-related purposes, but mosdns is more specialized for DNS manipulation, while CoreDNS offers a full-featured DNS server with extensive plugin support.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

mosdns

功能概述、配置方式、教程等,详见: wiki

下载预编译文件、更新日志,详见: release

docker 镜像: docker hub