style: format golang import package code style (#58)

Co-authored-by: Kevin Yu <yqlbu@Bu.edu>
This commit is contained in:
czybjtu 2023-04-23 13:27:29 +08:00 committed by GitHub
parent 064bf1ebbc
commit e71c272693
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
80 changed files with 276 additions and 200 deletions

View File

@ -43,6 +43,8 @@ dae: ebpf
clean-ebpf:
@rm -f control/bpf_bpf*.go && \
rm -f control/bpf_bpf*.o
fmt:
go fmt ./...
# $BPF_CLANG is used in go:generate invocations.
ebpf: export BPF_CLANG := $(CLANG)

View File

@ -7,6 +7,7 @@ package cmd
import (
"fmt"
"github.com/daeuniverse/dae/config"
"github.com/spf13/cobra"
)

View File

@ -2,10 +2,11 @@ package internal
import (
"fmt"
"github.com/sirupsen/logrus"
"os"
"os/exec"
"path/filepath"
"github.com/sirupsen/logrus"
)
func AutoSu() {

View File

@ -7,12 +7,13 @@ package cmd
import (
"fmt"
"github.com/spf13/cobra"
"github.com/daeuniverse/dae/cmd/internal"
"os"
"strconv"
"strings"
"syscall"
"github.com/daeuniverse/dae/cmd/internal"
"github.com/spf13/cobra"
)
var (

View File

@ -3,17 +3,6 @@ package cmd
import (
"errors"
"fmt"
"github.com/daeuniverse/dae/cmd/internal"
"github.com/daeuniverse/dae/common"
"github.com/daeuniverse/dae/common/subscription"
"github.com/daeuniverse/dae/config"
"github.com/daeuniverse/dae/control"
"github.com/daeuniverse/dae/pkg/config_parser"
"github.com/daeuniverse/dae/pkg/logger"
"github.com/mohae/deepcopy"
"github.com/okzk/sdnotify"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
"math/rand"
"net"
"net/http"
@ -25,6 +14,18 @@ import (
"strings"
"syscall"
"time"
"github.com/daeuniverse/dae/cmd/internal"
"github.com/daeuniverse/dae/common"
"github.com/daeuniverse/dae/common/subscription"
"github.com/daeuniverse/dae/config"
"github.com/daeuniverse/dae/control"
"github.com/daeuniverse/dae/pkg/config_parser"
"github.com/daeuniverse/dae/pkg/logger"
"github.com/mohae/deepcopy"
"github.com/okzk/sdnotify"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
)
const (

View File

@ -7,12 +7,13 @@ package cmd
import (
"fmt"
"github.com/daeuniverse/dae/cmd/internal"
"github.com/spf13/cobra"
"os"
"strconv"
"strings"
"syscall"
"github.com/daeuniverse/dae/cmd/internal"
"github.com/spf13/cobra"
)
var (

View File

@ -7,8 +7,9 @@ package cmd
import (
"fmt"
"github.com/spf13/cobra"
"os"
"github.com/spf13/cobra"
)
var (

View File

@ -8,8 +8,6 @@ package assets
import (
"errors"
"fmt"
"github.com/adrg/xdg"
"github.com/sirupsen/logrus"
"io/fs"
"os"
"path/filepath"
@ -17,6 +15,9 @@ import (
"strings"
"sync"
"time"
"github.com/adrg/xdg"
"github.com/sirupsen/logrus"
)
const CacheTimeout = 5 * time.Second

View File

@ -7,9 +7,10 @@ package bitlist
import (
"fmt"
"github.com/mzz2017/softwind/common"
"github.com/daeuniverse/dae/pkg/anybuffer"
"math/bits"
"github.com/daeuniverse/dae/pkg/anybuffer"
"github.com/mzz2017/softwind/common"
)
// CompactBitList allows your units to be of arbitrary bit size.

View File

@ -6,8 +6,9 @@
package consts
import (
"golang.org/x/sys/unix"
"net/netip"
"golang.org/x/sys/unix"
)
type DialerSelectionPolicy string

View File

@ -6,9 +6,10 @@
package consts
import (
internal "github.com/daeuniverse/dae/pkg/ebpf_internal"
"strconv"
"strings"
internal "github.com/daeuniverse/dae/pkg/ebpf_internal"
)
const (

View File

@ -6,11 +6,12 @@
package common
import (
"github.com/sirupsen/logrus"
"os"
"path/filepath"
"strconv"
"strings"
"github.com/sirupsen/logrus"
)
func ReportMemory(tag string) {

View File

@ -6,8 +6,9 @@
package json
import (
jsoniter "github.com/json-iterator/go"
"unsafe"
jsoniter "github.com/json-iterator/go"
)
type FuzzyBoolDecoder struct {

View File

@ -9,17 +9,18 @@ import (
"context"
"encoding/binary"
"fmt"
"github.com/mzz2017/softwind/netproxy"
"github.com/mzz2017/softwind/pkg/fastrand"
"github.com/mzz2017/softwind/pool"
"github.com/sirupsen/logrus"
"golang.org/x/net/dns/dnsmessage"
"io"
"math"
"net/netip"
"strings"
"sync"
"time"
"github.com/mzz2017/softwind/netproxy"
"github.com/mzz2017/softwind/pkg/fastrand"
"github.com/mzz2017/softwind/pool"
"github.com/sirupsen/logrus"
"golang.org/x/net/dns/dnsmessage"
)
var (

View File

@ -9,11 +9,12 @@ import (
"context"
"errors"
"fmt"
"net/netip"
"sync"
"github.com/mzz2017/softwind/netproxy"
"github.com/sirupsen/logrus"
"golang.org/x/net/dns/dnsmessage"
"net/netip"
"sync"
)
type Ip46 struct {

View File

@ -10,8 +10,6 @@ import (
"bytes"
"encoding/json"
"fmt"
"github.com/sirupsen/logrus"
"github.com/daeuniverse/dae/common"
"io"
"net"
"net/http"
@ -20,6 +18,9 @@ import (
"path/filepath"
"strconv"
"strings"
"github.com/daeuniverse/dae/common"
"github.com/sirupsen/logrus"
)
type sip008 struct {

View File

@ -12,10 +12,6 @@ import (
"encoding/binary"
"encoding/hex"
"fmt"
internal "github.com/daeuniverse/dae/pkg/ebpf_internal"
"github.com/vishvananda/netlink"
"golang.org/x/net/dns/dnsmessage"
"golang.org/x/sys/unix"
"net/netip"
"net/url"
"path/filepath"
@ -24,6 +20,11 @@ import (
"strings"
"time"
"unsafe"
internal "github.com/daeuniverse/dae/pkg/ebpf_internal"
"github.com/vishvananda/netlink"
"golang.org/x/net/dns/dnsmessage"
"golang.org/x/sys/unix"
)
var (

View File

@ -7,6 +7,10 @@ package dns
import (
"fmt"
"net/netip"
"net/url"
"sync"
"github.com/daeuniverse/dae/common"
"github.com/daeuniverse/dae/common/assets"
"github.com/daeuniverse/dae/common/consts"
@ -14,9 +18,6 @@ import (
"github.com/daeuniverse/dae/config"
"github.com/sirupsen/logrus"
"golang.org/x/net/dns/dnsmessage"
"net/netip"
"net/url"
"sync"
)
var BadUpstreamFormatError = fmt.Errorf("bad upstream format")

View File

@ -7,11 +7,12 @@ package dns
import (
"fmt"
"github.com/sirupsen/logrus"
"strings"
"github.com/daeuniverse/dae/component/routing"
"github.com/daeuniverse/dae/pkg/config_parser"
"github.com/sirupsen/logrus"
"golang.org/x/net/dns/dnsmessage"
"strings"
)
var typeNames = map[string]dnsmessage.Type{

View File

@ -7,6 +7,8 @@ package dns
import (
"fmt"
"strconv"
"github.com/daeuniverse/dae/common/consts"
"github.com/daeuniverse/dae/component/routing"
"github.com/daeuniverse/dae/component/routing/domain_matcher"
@ -14,7 +16,6 @@ import (
"github.com/daeuniverse/dae/pkg/config_parser"
"github.com/sirupsen/logrus"
"golang.org/x/net/dns/dnsmessage"
"strconv"
)
type RequestMatcherBuilder struct {

View File

@ -7,6 +7,10 @@ package dns
import (
"fmt"
"net/netip"
"strconv"
"strings"
"github.com/daeuniverse/dae/common/consts"
"github.com/daeuniverse/dae/component/routing"
"github.com/daeuniverse/dae/component/routing/domain_matcher"
@ -16,9 +20,6 @@ import (
"github.com/mzz2017/softwind/pkg/zeroalloc/buffer"
"github.com/sirupsen/logrus"
"golang.org/x/net/dns/dnsmessage"
"net/netip"
"strconv"
"strings"
)
var ValidCidrChars = trie.NewValidChars([]byte{'0', '1'})

View File

@ -8,14 +8,15 @@ package dns
import (
"context"
"fmt"
"github.com/daeuniverse/dae/common/consts"
"github.com/daeuniverse/dae/common/netutils"
"github.com/mzz2017/softwind/protocol/direct"
"net"
"net/url"
"strconv"
"sync"
"time"
"github.com/daeuniverse/dae/common/consts"
"github.com/daeuniverse/dae/common/netutils"
"github.com/mzz2017/softwind/protocol/direct"
)
var (

View File

@ -7,12 +7,13 @@ package dialer
import (
"fmt"
"github.com/daeuniverse/dae/common/consts"
"github.com/mzz2017/softwind/pkg/fastrand"
"github.com/sirupsen/logrus"
"strings"
"sync"
"time"
"github.com/daeuniverse/dae/common/consts"
"github.com/mzz2017/softwind/pkg/fastrand"
"github.com/sirupsen/logrus"
)
const (

View File

@ -7,8 +7,9 @@ package dialer
import (
"fmt"
"github.com/mzz2017/softwind/netproxy"
"net"
"github.com/mzz2017/softwind/netproxy"
)
type blockDialer struct {

View File

@ -9,13 +9,6 @@ import (
"context"
"errors"
"fmt"
"github.com/daeuniverse/dae/common/consts"
"github.com/daeuniverse/dae/common/netutils"
"github.com/mzz2017/softwind/netproxy"
"github.com/mzz2017/softwind/pkg/fastrand"
"github.com/mzz2017/softwind/protocol/direct"
"github.com/sirupsen/logrus"
"golang.org/x/net/dns/dnsmessage"
"net"
"net/http"
"net/netip"
@ -25,6 +18,14 @@ import (
"strings"
"sync"
"time"
"github.com/daeuniverse/dae/common/consts"
"github.com/daeuniverse/dae/common/netutils"
"github.com/mzz2017/softwind/netproxy"
"github.com/mzz2017/softwind/pkg/fastrand"
"github.com/mzz2017/softwind/protocol/direct"
"github.com/sirupsen/logrus"
"golang.org/x/net/dns/dnsmessage"
)
type NetworkType struct {

View File

@ -3,10 +3,11 @@ package dialer
import (
"context"
"fmt"
"github.com/mzz2017/softwind/netproxy"
"github.com/sirupsen/logrus"
"sync"
"time"
"github.com/mzz2017/softwind/netproxy"
"github.com/sirupsen/logrus"
)
var (

View File

@ -2,13 +2,14 @@ package http
import (
"fmt"
"github.com/mzz2017/softwind/protocol/direct"
"github.com/mzz2017/softwind/protocol/http"
"github.com/daeuniverse/dae/common"
"github.com/daeuniverse/dae/component/outbound/dialer"
"net"
"net/url"
"strconv"
"github.com/daeuniverse/dae/common"
"github.com/daeuniverse/dae/component/outbound/dialer"
"github.com/mzz2017/softwind/protocol/direct"
"github.com/mzz2017/softwind/protocol/http"
)
func init() {

View File

@ -7,8 +7,9 @@ package dialer
import (
"fmt"
"github.com/daeuniverse/dae/common"
"net/url"
"github.com/daeuniverse/dae/common"
)
type FromLinkCreator func(gOption *GlobalOption, iOption InstanceOption, link string) (dialer *Dialer, err error)

View File

@ -3,17 +3,18 @@ package shadowsocks
import (
"encoding/base64"
"fmt"
"github.com/mzz2017/softwind/netproxy"
"github.com/mzz2017/softwind/protocol"
"github.com/mzz2017/softwind/protocol/direct"
"github.com/mzz2017/softwind/protocol/shadowsocks"
"github.com/daeuniverse/dae/common"
"github.com/daeuniverse/dae/component/outbound/dialer"
"github.com/daeuniverse/dae/component/outbound/transport/simpleobfs"
"net"
"net/url"
"strconv"
"strings"
"github.com/daeuniverse/dae/common"
"github.com/daeuniverse/dae/component/outbound/dialer"
"github.com/daeuniverse/dae/component/outbound/transport/simpleobfs"
"github.com/mzz2017/softwind/netproxy"
"github.com/mzz2017/softwind/protocol"
"github.com/mzz2017/softwind/protocol/direct"
"github.com/mzz2017/softwind/protocol/shadowsocks"
)
func init() {

View File

@ -3,17 +3,18 @@ package shadowsocksr
import (
"encoding/base64"
"fmt"
"net"
"net/url"
"strconv"
"strings"
"github.com/daeuniverse/dae/common"
"github.com/daeuniverse/dae/component/outbound/dialer"
"github.com/mzz2017/softwind/protocol"
"github.com/mzz2017/softwind/protocol/direct"
"github.com/mzz2017/softwind/protocol/shadowsocks_stream"
"github.com/mzz2017/softwind/transport/shadowsocksr/obfs"
"github.com/mzz2017/softwind/transport/shadowsocksr/proto"
"github.com/daeuniverse/dae/common"
"github.com/daeuniverse/dae/component/outbound/dialer"
"net"
"net/url"
"strconv"
"strings"
)
func init() {

View File

@ -7,10 +7,11 @@ package dialer
import (
"fmt"
"golang.org/x/sys/unix"
"net/netip"
"runtime"
"syscall"
"golang.org/x/sys/unix"
)
var fwmarkIoctl int

View File

@ -2,13 +2,14 @@ package socks
import (
"fmt"
"github.com/mzz2017/softwind/protocol/direct"
"github.com/daeuniverse/dae/component/outbound/dialer"
//"github.com/mzz2017/softwind/protocol/socks4"
"github.com/mzz2017/softwind/protocol/socks5"
"net"
"net/url"
"strconv"
"github.com/daeuniverse/dae/component/outbound/dialer"
"github.com/mzz2017/softwind/protocol/direct"
"github.com/mzz2017/softwind/protocol/socks5"
)
func init() {

View File

@ -2,18 +2,19 @@ package trojan
import (
"fmt"
"github.com/mzz2017/softwind/netproxy"
"github.com/mzz2017/softwind/protocol"
"github.com/mzz2017/softwind/protocol/direct"
"github.com/mzz2017/softwind/transport/grpc"
"github.com/daeuniverse/dae/common"
"github.com/daeuniverse/dae/component/outbound/dialer"
"github.com/daeuniverse/dae/component/outbound/transport/tls"
"github.com/daeuniverse/dae/component/outbound/transport/ws"
"net"
"net/url"
"strconv"
"strings"
"github.com/daeuniverse/dae/common"
"github.com/daeuniverse/dae/component/outbound/dialer"
"github.com/daeuniverse/dae/component/outbound/transport/tls"
"github.com/daeuniverse/dae/component/outbound/transport/ws"
"github.com/mzz2017/softwind/netproxy"
"github.com/mzz2017/softwind/protocol"
"github.com/mzz2017/softwind/protocol/direct"
"github.com/mzz2017/softwind/transport/grpc"
)
func init() {

View File

@ -3,6 +3,11 @@ package v2ray
import (
"encoding/base64"
"fmt"
"net"
"net/url"
"regexp"
"strings"
"github.com/daeuniverse/dae/common"
"github.com/daeuniverse/dae/component/outbound/dialer"
"github.com/daeuniverse/dae/component/outbound/transport/tls"
@ -12,10 +17,6 @@ import (
"github.com/mzz2017/softwind/protocol"
"github.com/mzz2017/softwind/protocol/direct"
"github.com/mzz2017/softwind/transport/grpc"
"net"
"net/url"
"regexp"
"strings"
)
func init() {

View File

@ -7,11 +7,12 @@ package outbound
import (
"fmt"
"time"
"github.com/daeuniverse/dae/common/consts"
"github.com/daeuniverse/dae/component/outbound/dialer"
"github.com/mzz2017/softwind/netproxy"
"github.com/sirupsen/logrus"
"time"
)
var NoAliveDialerError = fmt.Errorf("no alive dialer")

View File

@ -6,12 +6,13 @@
package outbound
import (
"testing"
"time"
"github.com/daeuniverse/dae/common/consts"
"github.com/daeuniverse/dae/component/outbound/dialer"
"github.com/daeuniverse/dae/pkg/logger"
"github.com/mzz2017/softwind/pkg/fastrand"
"testing"
"time"
)
const (

View File

@ -7,9 +7,10 @@ package outbound
import (
"fmt"
"strconv"
"github.com/daeuniverse/dae/common/consts"
"github.com/daeuniverse/dae/config"
"strconv"
)
type DialerSelectionPolicy struct {

View File

@ -7,10 +7,11 @@ package outbound
import (
"fmt"
"github.com/daeuniverse/dae/component/outbound/dialer"
"github.com/daeuniverse/dae/pkg/config_parser"
"regexp"
"strings"
"github.com/daeuniverse/dae/component/outbound/dialer"
"github.com/daeuniverse/dae/pkg/config_parser"
)
const (

View File

@ -6,14 +6,14 @@
package outbound
import (
_ "github.com/mzz2017/softwind/protocol/shadowsocks"
_ "github.com/mzz2017/softwind/protocol/trojanc"
_ "github.com/mzz2017/softwind/protocol/vless"
_ "github.com/mzz2017/softwind/protocol/vmess"
_ "github.com/daeuniverse/dae/component/outbound/dialer/http"
_ "github.com/daeuniverse/dae/component/outbound/dialer/shadowsocks"
_ "github.com/daeuniverse/dae/component/outbound/dialer/shadowsocksr"
_ "github.com/daeuniverse/dae/component/outbound/dialer/socks"
_ "github.com/daeuniverse/dae/component/outbound/dialer/trojan"
_ "github.com/daeuniverse/dae/component/outbound/dialer/v2ray"
_ "github.com/mzz2017/softwind/protocol/shadowsocks"
_ "github.com/mzz2017/softwind/protocol/trojanc"
_ "github.com/mzz2017/softwind/protocol/vless"
_ "github.com/mzz2017/softwind/protocol/vmess"
)

View File

@ -56,7 +56,6 @@ func NewSimpleObfs(s string, d netproxy.Dialer) (*SimpleObfs, error) {
return t, nil
}
func (s *SimpleObfs) Dial(network, addr string) (c netproxy.Conn, err error) {
magicNetwork, err := netproxy.ParseMagicNetwork(network)
if err != nil {
@ -75,6 +74,7 @@ func (s *SimpleObfs) Dial(network, addr string) (c netproxy.Conn, err error) {
func (s *SimpleObfs) DialUdp(addr string) (conn netproxy.PacketConn, err error) {
return nil, fmt.Errorf("%w: simpleobfs+udp", netproxy.UnsupportedTunnelTypeError)
}
// DialTcp connects to the address addr on the network net via the proxy.
func (s *SimpleObfs) DialTcp(addr string) (c netproxy.Conn, err error) {

View File

@ -7,15 +7,16 @@ package domain_matcher
import (
"fmt"
"hash/fnv"
"math/rand"
"reflect"
"testing"
"github.com/daeuniverse/dae/common/consts"
"github.com/daeuniverse/dae/component/routing"
"github.com/daeuniverse/dae/config"
"github.com/daeuniverse/dae/pkg/config_parser"
"github.com/sirupsen/logrus"
"hash/fnv"
"math/rand"
"reflect"
"testing"
)
var TestSample = []string{
@ -94,7 +95,6 @@ var TestSample = []string{
}
type RoutingMatcherBuilder struct {
outboundName2Id map[string]uint8
simulatedDomainSet []routing.DomainSet
Fallback string
@ -206,7 +206,7 @@ func BenchmarkAhocorasickSlimtrie(b *testing.B) {
if err != nil {
b.Fatal(err)
}
ahocorasick := NewAhocorasickSlimtrie(consts.MaxMatchSetLen)
ahocorasick := NewAhocorasickSlimtrie(logrus.StandardLogger(), consts.MaxMatchSetLen)
for _, domains := range simulatedDomainSet {
ahocorasick.AddSet(domains.RuleIndex, domains.Domains, domains.Key)
}

View File

@ -7,10 +7,10 @@ package routing
import (
"fmt"
"github.com/sirupsen/logrus"
"github.com/daeuniverse/dae/common"
"github.com/daeuniverse/dae/common/consts"
"github.com/daeuniverse/dae/pkg/config_parser"
"github.com/sirupsen/logrus"
"net/netip"
"strings"
)

View File

@ -10,8 +10,8 @@ import (
"crypto/cipher"
"crypto/sha256"
"encoding/binary"
"github.com/mzz2017/softwind/pool"
"github.com/daeuniverse/dae/common"
"github.com/mzz2017/softwind/pool"
"golang.org/x/crypto/hkdf"
"io"
)

View File

@ -8,8 +8,9 @@ package quicutils
import (
"bytes"
"encoding/hex"
"github.com/daeuniverse/dae/common"
"testing"
"github.com/daeuniverse/dae/common"
)
var destConnId = []byte{0x83, 0x94, 0xc8, 0xf0, 0x3e, 0x51, 0x57, 0x08}

View File

@ -7,9 +7,10 @@ package sniffing
import (
"errors"
"github.com/mzz2017/softwind/pool"
"github.com/daeuniverse/dae/component/sniffing/internal/quicutils"
"io/fs"
"github.com/daeuniverse/dae/component/sniffing/internal/quicutils"
"github.com/mzz2017/softwind/pool"
)
const (

View File

@ -7,8 +7,9 @@ package sniffing
import (
"encoding/hex"
"github.com/sirupsen/logrus"
"testing"
"github.com/sirupsen/logrus"
)
var QuicStream, _ = hex.DecodeString("c00000000108d60451e5cb0f7050000044bc9acdcae1f0bbb8b98bb6ce5371cec3db5d4212d08d370fd220bd92fd3f42b06d8b25feea28c190ce741b316d28d8be11bd5637db3b00bf945ee330066b5262e7cef82d1f1fcc19d1879e1a7e062d068217a7a62c2fc8dd5226e6988d605578f05bebe102825af36fdfd50514cc41de82acde9d10c3f6c0650273c6f750251925d730a558ec820c221665550b0d41e38494b884393197d38cf9e32dcd0d4cbe6a75be00069bdd04836c6e83a360ee072b9da44c9dfec05762bb0bea1585755e22fdb0b11c67166b3178207801847a8d079fb6600a8bc22860ffb98d49dd56fbdd0c16bbae54d219adbcda402e43fc524667b7f08171820958ddf5b111cf776555aa0b23d6820748a4bb9695d754a1a2ce30901d90cdd5ab8aecae5b9fce5b6cf0e993a7316ce8eded51b382587a5c31ed27c6e96808a7eab84ec168b1648c6c0218760d6304c718266df2ac5c73e1f34f1b57a025a8fe5fecfbf3ff90b51cd26f5b93ef47fe790324951cb347a85b3ed5ba3e04880f83041e13f142f72173a9cc79ff3303a7b981b133600e47852ea8a03b5414f9cc39f5401b187bb22373bd75c64b79bb4601e12283f7d4f0916509e8f0114574e1ac316b07b83887eb451f268a325b713fe2f53b9eda5db85eaef20c632bd839d8fe49318fc913192d107d5416bc57d619c0db700abc4db48a73abd32a3d98f06c90aa17924321774b2d8b073ca1e1062a6473eba613037deefd306962a5bc0b7843678f25fbf74cff6430ef1c324a12f0beadb2bbe861cb211b7114b55164fe00907d7b41bd0140bdbe9c405405030b58478803e1d76082583d7122ee8552b5f901ca924afdefe3a30f345793108f50a9d934077864d6533db956d5d424f0aeed1fd85a6292d2ae7bd392a8223e66f46d7ffd1ad16871774c133af6dec7a97e67987158738d40bb496e3e3d478a01e0b995c44e08e37f137d4885f382176d9f5f7b00b81c96e83f2b60b762c8ed89a1077bb860c317332af8595cbe9afc3dab1da1a62cbd721f8eca8ee8be4240356ed9918fb4beddcab654ed085112e6abfeb0680979a20edd9426719d0f97bff2031f2af40dc47f47b815665f28f920fe5ceef4481f5195811e9cdc23dcec251550ed17111ab45124498dfbaae87b2081814d3fdfdb581a651ea3929fede7e9e01f8475360a484478bcde90d463b76b0ff486aba41f9b7d043ad3dac35e50569bf007f12c08b433474c4aa085bf0ff1ebbb2ee6e7dbdc92c429f9b54b098a5d34b0448458919bbb13b0b4c0ba82a130e8d9f105d724729a22c9c31476bfa609eb53f2d7a1c7134e60ba365a3082775d601f7c96f52e915da5e7670aa33e6027bca2a99ec8871ea424febb741bf2ca0e1d911b7047b6ddfe17c03d9c1aedb106e0ec40b1a8c980bfdcce083a1769bbdd8fd149f86f6cae50ab9b8dc7c1306c03a4a9bb2dcf0c477ae7431fba5f1e7e999bccb7ad73df33d9931f9e7291a4f882b4065ac63d58d81746e48f5035074b90cac149210efabded7f6099df28959f74aeb8ab2b8c63cf85c2ca3e054d70d31d3b3d24f4f8d36dfb82c9371f31313fa7a5bb56b10ef75d8aa4b976d9196728e6ef4401f9e2cf33058cda0b1464c8f14d404c48e4c9258830985eecccbaddd06407605f1af40542c727ab80e460cb322613204a60fb135e890e1f3b95d9a64a45450815db1c741837bf4a")

View File

@ -7,8 +7,9 @@ package sniffing
import (
"fmt"
"github.com/mzz2017/softwind/pkg/fastrand"
"testing"
"github.com/mzz2017/softwind/pkg/fastrand"
)
var (

View File

@ -8,8 +8,9 @@ package sniffing
import (
"bytes"
"encoding/binary"
"github.com/daeuniverse/dae/component/sniffing/internal/quicutils"
"strings"
"github.com/daeuniverse/dae/component/sniffing/internal/quicutils"
)
const (

View File

@ -7,8 +7,9 @@ package sniffing
import (
"encoding/hex"
"github.com/sirupsen/logrus"
"testing"
"github.com/sirupsen/logrus"
)
var tlsStream, _ = hex.DecodeString("1603010200010001fc0303d90fdf25b0c7a11c3eb968604a065157a149407c139c22ed32f5c6f486ed2c04206c51c32da7f83c3c19766be60d45d264e898c77504e34915c44caa69513c2221003e130213031301c02cc030009fcca9cca8ccaac02bc02f009ec024c028006bc023c0270067c00ac0140039c009c0130033009d009c003d003c0035002f00ff0100017500000013001100000e7777772e676f6f676c652e636f6d000b000403000102000a00160014001d0017001e00190018010001010102010301040010000e000c02683208687474702f312e31001600000017000000310000000d002a0028040305030603080708080809080a080b080408050806040105010601030303010302040205020602002b0009080304030303020301002d00020101003300260024001d00207fe08226bdc4fb1715e477506b6afe8f3abe2d20daa1f8c78c5483f1a90a9b19001500af00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000")

View File

@ -7,9 +7,10 @@ package config
import (
"fmt"
"github.com/daeuniverse/dae/pkg/config_parser"
"reflect"
"time"
"github.com/daeuniverse/dae/pkg/config_parser"
)
type Global struct {

View File

@ -8,12 +8,13 @@ package config
import (
"errors"
"fmt"
"github.com/daeuniverse/dae/common"
"github.com/daeuniverse/dae/pkg/config_parser"
"io"
"os"
"path/filepath"
"strings"
"github.com/daeuniverse/dae/common"
"github.com/daeuniverse/dae/pkg/config_parser"
)
var (

View File

@ -8,11 +8,12 @@ package config
import (
"bytes"
"fmt"
"github.com/daeuniverse/dae/common"
"github.com/daeuniverse/dae/pkg/config_parser"
"reflect"
"strconv"
"strings"
"github.com/daeuniverse/dae/common"
"github.com/daeuniverse/dae/pkg/config_parser"
)
// Marshal assume all tokens should be legal, and does not prevent injection attacks.

View File

@ -6,9 +6,10 @@
package config
import (
jsoniter "github.com/json-iterator/go"
"reflect"
"sort"
jsoniter "github.com/json-iterator/go"
)
type Outline struct {

View File

@ -7,10 +7,11 @@ package config
import (
"fmt"
"github.com/daeuniverse/dae/common"
"github.com/daeuniverse/dae/pkg/config_parser"
"reflect"
"strings"
"github.com/daeuniverse/dae/common"
"github.com/daeuniverse/dae/pkg/config_parser"
)
func StringListParser(to reflect.Value, section *config_parser.Section) error {

View File

@ -6,9 +6,10 @@
package config
import (
"strings"
"github.com/daeuniverse/dae/common/consts"
"github.com/daeuniverse/dae/pkg/config_parser"
"strings"
)
type patch func(params *Config) error

View File

@ -6,10 +6,11 @@
package control
import (
"github.com/daeuniverse/dae/common/consts"
"net"
"net/netip"
"strconv"
"github.com/daeuniverse/dae/common/consts"
)
func RefineSourceToShow(src netip.AddrPort, dst netip.Addr, lanWanFlag consts.LanWanFlag) (srcToShow string) {

View File

@ -10,17 +10,18 @@ import (
"encoding/binary"
"errors"
"fmt"
"github.com/cilium/ebpf"
"github.com/daeuniverse/dae/common"
"github.com/daeuniverse/dae/common/consts"
"github.com/daeuniverse/dae/pkg/ebpf_internal"
"github.com/sirupsen/logrus"
"net/netip"
"os"
"path/filepath"
"reflect"
"strings"
"sync"
"github.com/cilium/ebpf"
"github.com/daeuniverse/dae/common"
"github.com/daeuniverse/dae/common/consts"
internal "github.com/daeuniverse/dae/pkg/ebpf_internal"
"github.com/sirupsen/logrus"
)
type _bpfTuples struct {

View File

@ -6,11 +6,12 @@
package control
import (
"strconv"
"github.com/cilium/ebpf"
"github.com/daeuniverse/dae/component/outbound/dialer"
"github.com/sirupsen/logrus"
"golang.org/x/sys/unix"
"strconv"
)
func FormatL4Proto(l4proto uint8) string {

View File

@ -8,6 +8,16 @@ package control
import (
"context"
"fmt"
"net"
"net/netip"
"os"
"path/filepath"
"strconv"
"strings"
"sync"
"syscall"
"time"
"github.com/bits-and-blooms/bloom/v3"
"github.com/cilium/ebpf"
"github.com/cilium/ebpf/rlimit"
@ -28,15 +38,6 @@ import (
"github.com/sirupsen/logrus"
"golang.org/x/net/dns/dnsmessage"
"golang.org/x/sys/unix"
"net"
"net/netip"
"os"
"path/filepath"
"strconv"
"strings"
"sync"
"syscall"
"time"
)
type ControlPlane struct {

View File

@ -8,6 +8,11 @@ package control
import (
"context"
"fmt"
"net"
"net/netip"
"os"
"regexp"
"github.com/cilium/ebpf"
ciliumLink "github.com/cilium/ebpf/link"
"github.com/daeuniverse/dae/common"
@ -19,10 +24,6 @@ import (
"github.com/vishvananda/netlink"
"golang.org/x/net/dns/dnsmessage"
"golang.org/x/sys/unix"
"net"
"net/netip"
"os"
"regexp"
)
// coreFlip should be 0 or 1

View File

@ -6,10 +6,11 @@
package control
import (
"github.com/mohae/deepcopy"
"golang.org/x/net/dns/dnsmessage"
"net/netip"
"time"
"github.com/mohae/deepcopy"
"golang.org/x/net/dns/dnsmessage"
)
type DnsCache struct {

View File

@ -10,6 +10,14 @@ import (
"encoding/binary"
"errors"
"fmt"
"io"
"math"
"net"
"net/netip"
"strings"
"sync"
"time"
"github.com/daeuniverse/dae/common/consts"
"github.com/daeuniverse/dae/common/netutils"
"github.com/daeuniverse/dae/component/dns"
@ -21,13 +29,6 @@ import (
"github.com/mzz2017/softwind/pool"
"github.com/sirupsen/logrus"
"golang.org/x/net/dns/dnsmessage"
"io"
"math"
"net"
"net/netip"
"strings"
"sync"
"time"
)
const (

View File

@ -8,11 +8,12 @@ package control
import (
"encoding/binary"
"fmt"
"golang.org/x/net/dns/dnsmessage"
"hash/fnv"
"math/rand"
"net/netip"
"strings"
"golang.org/x/net/dns/dnsmessage"
)
// FlipDnsQuestionCase is used to reduce dns pollution.

View File

@ -8,6 +8,9 @@ package control
import (
"encoding/binary"
"fmt"
"net/netip"
"strconv"
"github.com/cilium/ebpf"
"github.com/daeuniverse/dae/common"
"github.com/daeuniverse/dae/common/consts"
@ -16,8 +19,6 @@ import (
"github.com/daeuniverse/dae/config"
"github.com/daeuniverse/dae/pkg/config_parser"
"github.com/sirupsen/logrus"
"net/netip"
"strconv"
)
type RoutingMatcherBuilder struct {

View File

@ -8,11 +8,12 @@ package control
import (
"encoding/binary"
"fmt"
"net"
"github.com/cilium/ebpf"
"github.com/daeuniverse/dae/common"
"github.com/daeuniverse/dae/common/consts"
"github.com/daeuniverse/dae/component/routing"
"net"
)
type RoutingMatcher struct {

View File

@ -7,6 +7,11 @@ package control
import (
"fmt"
"net"
"net/netip"
"strings"
"time"
"github.com/daeuniverse/dae/common"
"github.com/daeuniverse/dae/common/consts"
"github.com/daeuniverse/dae/component/outbound/dialer"
@ -15,10 +20,6 @@ import (
"github.com/mzz2017/softwind/pkg/zeroalloc/io"
"github.com/sirupsen/logrus"
"golang.org/x/sys/unix"
"net"
"net/netip"
"strings"
"time"
)
const (

View File

@ -9,6 +9,12 @@ import (
"encoding/binary"
"errors"
"fmt"
"net"
"net/netip"
"syscall"
"time"
"unsafe"
"github.com/daeuniverse/dae/common"
"github.com/daeuniverse/dae/common/consts"
"github.com/daeuniverse/dae/component/outbound/dialer"
@ -17,11 +23,6 @@ import (
"github.com/mzz2017/softwind/pkg/zeroalloc/buffer"
"github.com/sirupsen/logrus"
"golang.org/x/net/dns/dnsmessage"
"net"
"net/netip"
"syscall"
"time"
"unsafe"
)
const (

View File

@ -8,12 +8,13 @@ package control
import (
"errors"
"fmt"
"github.com/daeuniverse/dae/component/outbound/dialer"
"github.com/mzz2017/softwind/netproxy"
"github.com/mzz2017/softwind/pool"
"net/netip"
"sync"
"time"
"github.com/daeuniverse/dae/component/outbound/dialer"
"github.com/mzz2017/softwind/netproxy"
"github.com/mzz2017/softwind/pool"
)
const (

View File

@ -10,13 +10,14 @@ import (
"encoding/binary"
"encoding/hex"
"fmt"
"net/netip"
"os"
"syscall"
"github.com/daeuniverse/dae/common"
"github.com/daeuniverse/dae/common/consts"
"github.com/mzz2017/softwind/netproxy"
"golang.org/x/sys/unix"
"net/netip"
"os"
"syscall"
)
func (c *ControlPlane) Route(src, dst netip.AddrPort, domain string, l4proto consts.L4ProtoType, routingResult *bpfRoutingResult) (outboundIndex consts.OutboundIndex, mark uint32, must bool, err error) {

View File

@ -8,13 +8,14 @@
package main
import (
"net/http"
"os"
"time"
"github.com/daeuniverse/dae/cmd"
"github.com/daeuniverse/dae/common/json"
jsoniter "github.com/json-iterator/go"
"github.com/json-iterator/go/extra"
"net/http"
"os"
"time"
)
func main() {

View File

@ -7,6 +7,7 @@ package anybuffer
import (
"errors"
"golang.org/x/exp/constraints"
)

View File

@ -7,6 +7,7 @@ package config_parser
import (
"fmt"
"github.com/antlr/antlr4/runtime/Go/antlr/v4"
"github.com/daeuniverse/dae-config-dist/go/dae_config"
)

View File

@ -7,10 +7,11 @@ package config_parser
import (
"fmt"
"github.com/antlr/antlr4/runtime/Go/antlr/v4"
"github.com/sirupsen/logrus"
"reflect"
"strings"
"github.com/antlr/antlr4/runtime/Go/antlr/v4"
"github.com/sirupsen/logrus"
)
type ErrorType string

View File

@ -9,11 +9,12 @@ package config_parser
import (
"fmt"
"github.com/antlr/antlr4/runtime/Go/antlr/v4"
"github.com/sirupsen/logrus"
"github.com/daeuniverse/dae-config-dist/go/dae_config"
"strconv"
"strings"
"github.com/antlr/antlr4/runtime/Go/antlr/v4"
"github.com/daeuniverse/dae-config-dist/go/dae_config"
"github.com/sirupsen/logrus"
)
type Walker struct {

View File

@ -4,8 +4,9 @@ package internal
import (
"fmt"
"github.com/daeuniverse/dae/pkg/ebpf_internal/internal/unix"
"sync"
"github.com/daeuniverse/dae/pkg/ebpf_internal/internal/unix"
)
const (

View File

@ -3,11 +3,12 @@
package geodata
import (
"reflect"
"sync"
_ "github.com/daeuniverse/dae/pkg/geodata/protoext"
"google.golang.org/protobuf/reflect/protoreflect"
"google.golang.org/protobuf/runtime/protoimpl"
"reflect"
"sync"
)
const (

View File

@ -10,10 +10,11 @@ package geodata
import (
"errors"
"fmt"
"google.golang.org/protobuf/encoding/protowire"
"io"
"os"
"strings"
"google.golang.org/protobuf/encoding/protowire"
)
var (

View File

@ -9,10 +9,11 @@ package geodata
import (
"fmt"
"github.com/sirupsen/logrus"
"google.golang.org/protobuf/proto"
"os"
"strings"
"github.com/sirupsen/logrus"
"google.golang.org/protobuf/proto"
)
func UnmarshalGeoIp(log *logrus.Logger, filepath, code string) (*GeoIP, error) {

View File

@ -3,11 +3,12 @@
package protoext
import (
reflect "reflect"
sync "sync"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
descriptorpb "google.golang.org/protobuf/types/descriptorpb"
reflect "reflect"
sync "sync"
)
const (

View File

@ -5,10 +5,11 @@ package trie
import (
"fmt"
"github.com/daeuniverse/dae/common"
"github.com/daeuniverse/dae/common/bitlist"
"math/bits"
"sort"
"github.com/daeuniverse/dae/common"
"github.com/daeuniverse/dae/common/bitlist"
)
type ValidChars struct {