Skip to content

Commit

Permalink
Extract several packages to form a public API
Browse files Browse the repository at this point in the history
  • Loading branch information
foxcpp committed Jul 14, 2020
1 parent 7d497f8 commit bcceec4
Show file tree
Hide file tree
Showing 170 changed files with 385 additions and 392 deletions.
2 changes: 1 addition & 1 deletion cmd/maddyctl/appendlimit.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"fmt"

appendlimit "github.com/emersion/go-imap-appendlimit"
"github.com/foxcpp/maddy/internal/module"
"github.com/foxcpp/maddy/framework/module"
"github.com/urfave/cli"
)

Expand Down
2 changes: 1 addition & 1 deletion cmd/maddyctl/imap.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"github.com/emersion/go-imap"
imapsql "github.com/foxcpp/go-imap-sql"
"github.com/foxcpp/maddy/cmd/maddyctl/clitools"
"github.com/foxcpp/maddy/internal/module"
"github.com/foxcpp/maddy/framework/module"
"github.com/urfave/cli"
)

Expand Down
2 changes: 1 addition & 1 deletion cmd/maddyctl/imapacct.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (

specialuse "github.com/emersion/go-imap-specialuse"
"github.com/foxcpp/maddy/cmd/maddyctl/clitools"
"github.com/foxcpp/maddy/internal/module"
"github.com/foxcpp/maddy/framework/module"
"github.com/urfave/cli"
)

Expand Down
8 changes: 4 additions & 4 deletions cmd/maddyctl/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ import (
"path/filepath"

"github.com/foxcpp/maddy"
"github.com/foxcpp/maddy/internal/config"
"github.com/foxcpp/maddy/internal/hooks"
"github.com/foxcpp/maddy/internal/module"
parser "github.com/foxcpp/maddy/framework/cfgparser"
"github.com/foxcpp/maddy/framework/config"
"github.com/foxcpp/maddy/framework/hooks"
"github.com/foxcpp/maddy/framework/module"
"github.com/foxcpp/maddy/internal/updatepipe"
parser "github.com/foxcpp/maddy/pkg/cfgparser"
"github.com/urfave/cli"
"golang.org/x/crypto/bcrypt"
)
Expand Down
2 changes: 1 addition & 1 deletion cmd/maddyctl/users.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"os"

"github.com/foxcpp/maddy/cmd/maddyctl/clitools"
"github.com/foxcpp/maddy/internal/module"
"github.com/foxcpp/maddy/framework/module"
"github.com/urfave/cli"
)

Expand Down
4 changes: 2 additions & 2 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"os"
"path/filepath"

"github.com/foxcpp/maddy/internal/config"
"github.com/foxcpp/maddy/internal/log"
"github.com/foxcpp/maddy/framework/config"
"github.com/foxcpp/maddy/framework/log"
)

/*
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion internal/address/norm.go → framework/address/norm.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"strings"
"unicode/utf8"

"github.com/foxcpp/maddy/internal/dns"
"github.com/foxcpp/maddy/framework/dns"
"golang.org/x/net/idna"
"golang.org/x/text/unicode/norm"
)
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion pkg/cfgparser/parse.go → framework/cfgparser/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"strings"
"unicode"

"github.com/foxcpp/maddy/internal/config/lexer"
"github.com/foxcpp/maddy/framework/config/lexer"
)

// Node struct describes a parsed configurtion block or a simple directive.
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion internal/config/config.go → framework/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package config
import (
"fmt"

parser "github.com/foxcpp/maddy/pkg/cfgparser"
parser "github.com/foxcpp/maddy/framework/cfgparser"
)

type (
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package check
package modconfig

import (
"errors"
"fmt"
"strconv"
"strings"

"github.com/foxcpp/maddy/internal/config"
"github.com/foxcpp/maddy/internal/exterrors"
"github.com/foxcpp/maddy/internal/module"
"github.com/foxcpp/maddy/framework/config"
"github.com/foxcpp/maddy/framework/exterrors"
"github.com/foxcpp/maddy/framework/module"
)

// FailAction specifies actions that messages pipeline should take based on the
Expand All @@ -20,8 +20,8 @@ import (
// Add the configuration directive to allow user to specify the action:
// cfg.Custom("SOME_action", false, false,
// func() (interface{}, error) {
// return check.FailAction{Quarantine: true}, nil
// }, check.FailActionDirective, &yourModule.SOMEAction)
// return modconfig.FailAction{Quarantine: true}, nil
// }, modconfig.FailActionDirective, &yourModule.SOMEAction)
// return in func literal is the default value, you might want to adjust it.
//
// Call yourModule.SOMEAction.Apply on CheckResult containing only the
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package modconfig

import (
"github.com/foxcpp/maddy/internal/config"
"github.com/foxcpp/maddy/internal/module"
"github.com/foxcpp/maddy/framework/config"
"github.com/foxcpp/maddy/framework/module"
)

func MessageCheck(globals map[string]interface{}, args []string, block config.Node) (module.Check, error) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ import (
"reflect"
"strings"

"github.com/foxcpp/maddy/internal/config"
"github.com/foxcpp/maddy/internal/hooks"
"github.com/foxcpp/maddy/internal/log"
"github.com/foxcpp/maddy/internal/module"
parser "github.com/foxcpp/maddy/pkg/cfgparser"
parser "github.com/foxcpp/maddy/framework/cfgparser"
"github.com/foxcpp/maddy/framework/config"
"github.com/foxcpp/maddy/framework/hooks"
"github.com/foxcpp/maddy/framework/log"
"github.com/foxcpp/maddy/framework/module"
)

// createInlineModule is a helper function for config matchers that can create inline modules.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"fmt"
"io/ioutil"

"github.com/foxcpp/maddy/internal/log"
"github.com/foxcpp/maddy/framework/log"
)

func TLSClientBlock(m *Map, node Node) (interface{}, error) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package config
import (
"crypto/tls"

"github.com/foxcpp/maddy/internal/log"
"github.com/foxcpp/maddy/framework/log"
)

var strVersionsMap = map[string]uint16{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import (
"sync"
"time"

"github.com/foxcpp/maddy/internal/hooks"
"github.com/foxcpp/maddy/internal/log"
"github.com/foxcpp/maddy/framework/hooks"
"github.com/foxcpp/maddy/framework/log"
)

type TLSConfig struct {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion internal/log/log.go → framework/log/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"strings"
"time"

"github.com/foxcpp/maddy/internal/exterrors"
"github.com/foxcpp/maddy/framework/exterrors"
)

// Logger is the structure that writes formatted output to the underlying
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion internal/module/check.go → framework/module/check.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"github.com/emersion/go-message/textproto"
"github.com/emersion/go-msgauth/authres"
"github.com/emersion/go-smtp"
"github.com/foxcpp/maddy/internal/buffer"
"github.com/foxcpp/maddy/framework/buffer"
)

// Check is the module interface that is meant for read-only (with the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"context"

"github.com/emersion/go-message/textproto"
"github.com/foxcpp/maddy/internal/buffer"
"github.com/foxcpp/maddy/framework/buffer"
)

// DeliveryTarget interface represents abstract storage for the message data
Expand Down
4 changes: 2 additions & 2 deletions internal/module/dummy.go → framework/module/dummy.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"context"

"github.com/emersion/go-message/textproto"
"github.com/foxcpp/maddy/internal/buffer"
"github.com/foxcpp/maddy/internal/config"
"github.com/foxcpp/maddy/framework/buffer"
"github.com/foxcpp/maddy/framework/config"
)

// Dummy is a struct that implements PlainAuth and DeliveryTarget
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import (
"fmt"
"io"

"github.com/foxcpp/maddy/internal/config"
"github.com/foxcpp/maddy/internal/hooks"
"github.com/foxcpp/maddy/internal/log"
"github.com/foxcpp/maddy/framework/config"
"github.com/foxcpp/maddy/framework/hooks"
"github.com/foxcpp/maddy/framework/log"
)

var (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"context"

"github.com/emersion/go-message/textproto"
"github.com/foxcpp/maddy/internal/buffer"
"github.com/foxcpp/maddy/framework/buffer"
)

// Modifier is the module interface for modules that can mutate the
Expand Down
2 changes: 1 addition & 1 deletion internal/module/module.go → framework/module/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
package module

import (
"github.com/foxcpp/maddy/internal/config"
"github.com/foxcpp/maddy/framework/config"
)

// Module is the interface implemented by all maddy module instances.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"io"

"github.com/emersion/go-smtp"
"github.com/foxcpp/maddy/internal/future"
"github.com/foxcpp/maddy/framework/future"
)

// ConnState structure holds the state information of the protocol used to
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"context"

"github.com/emersion/go-message/textproto"
"github.com/foxcpp/maddy/internal/buffer"
"github.com/foxcpp/maddy/framework/buffer"
)

// StatusCollector is an object that is passed by message source
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package module
import (
"sync"

"github.com/foxcpp/maddy/internal/log"
"github.com/foxcpp/maddy/framework/log"
)

var (
Expand Down
File renamed without changes.
File renamed without changes.
8 changes: 4 additions & 4 deletions internal/auth/dovecot_sasl/dovecot_sasl.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ import (

"github.com/emersion/go-sasl"
dovecotsasl "github.com/foxcpp/go-dovecot-sasl"
"github.com/foxcpp/maddy/framework/config"
"github.com/foxcpp/maddy/framework/exterrors"
"github.com/foxcpp/maddy/framework/log"
"github.com/foxcpp/maddy/framework/module"
"github.com/foxcpp/maddy/internal/auth"
"github.com/foxcpp/maddy/internal/config"
"github.com/foxcpp/maddy/internal/exterrors"
"github.com/foxcpp/maddy/internal/log"
"github.com/foxcpp/maddy/internal/module"
)

type Auth struct {
Expand Down
6 changes: 3 additions & 3 deletions internal/auth/external/externalauth.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import (
"os"
"path/filepath"

"github.com/foxcpp/maddy/framework/config"
"github.com/foxcpp/maddy/framework/log"
"github.com/foxcpp/maddy/framework/module"
"github.com/foxcpp/maddy/internal/auth"
"github.com/foxcpp/maddy/internal/config"
"github.com/foxcpp/maddy/internal/log"
"github.com/foxcpp/maddy/internal/module"
)

type ExternalAuth struct {
Expand Down
2 changes: 1 addition & 1 deletion internal/auth/external/helperauth.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"io"
"os/exec"

"github.com/foxcpp/maddy/internal/module"
"github.com/foxcpp/maddy/framework/module"
)

func AuthUsingHelper(binaryPath, accountName, password string) error {
Expand Down
6 changes: 3 additions & 3 deletions internal/auth/pam/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import (
"os"
"path/filepath"

"github.com/foxcpp/maddy/framework/config"
"github.com/foxcpp/maddy/framework/log"
"github.com/foxcpp/maddy/framework/module"
"github.com/foxcpp/maddy/internal/auth/external"
"github.com/foxcpp/maddy/internal/config"
"github.com/foxcpp/maddy/internal/log"
"github.com/foxcpp/maddy/internal/module"
)

type Auth struct {
Expand Down
6 changes: 3 additions & 3 deletions internal/auth/pass_table/table.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import (
"fmt"
"strings"

"github.com/foxcpp/maddy/internal/config"
modconfig "github.com/foxcpp/maddy/internal/config/module"
"github.com/foxcpp/maddy/internal/module"
"github.com/foxcpp/maddy/framework/config"
modconfig "github.com/foxcpp/maddy/framework/config/module"
"github.com/foxcpp/maddy/framework/module"
"golang.org/x/crypto/bcrypt"
"golang.org/x/text/secure/precis"
)
Expand Down
2 changes: 1 addition & 1 deletion internal/auth/pass_table/table_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package pass_table
import (
"testing"

"github.com/foxcpp/maddy/internal/config"
"github.com/foxcpp/maddy/framework/config"
"github.com/foxcpp/maddy/internal/testutils"
)

Expand Down
6 changes: 3 additions & 3 deletions internal/auth/plain_separate/plain_separate.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import (
"errors"
"fmt"

"github.com/foxcpp/maddy/internal/config"
"github.com/foxcpp/maddy/internal/log"
"github.com/foxcpp/maddy/internal/module"
"github.com/foxcpp/maddy/framework/config"
"github.com/foxcpp/maddy/framework/log"
"github.com/foxcpp/maddy/framework/module"
)

type Auth struct {
Expand Down
2 changes: 1 addition & 1 deletion internal/auth/plain_separate/plain_separate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"testing"

"github.com/emersion/go-sasl"
"github.com/foxcpp/maddy/internal/module"
"github.com/foxcpp/maddy/framework/module"
)

type mockAuth struct {
Expand Down
8 changes: 4 additions & 4 deletions internal/auth/sasl.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import (
"net"

"github.com/emersion/go-sasl"
"github.com/foxcpp/maddy/internal/config"
modconfig "github.com/foxcpp/maddy/internal/config/module"
"github.com/foxcpp/maddy/internal/log"
"github.com/foxcpp/maddy/internal/module"
"github.com/foxcpp/maddy/framework/config"
modconfig "github.com/foxcpp/maddy/framework/config/module"
"github.com/foxcpp/maddy/framework/log"
"github.com/foxcpp/maddy/framework/module"
)

var (
Expand Down
2 changes: 1 addition & 1 deletion internal/auth/sasl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"net"
"testing"

"github.com/foxcpp/maddy/internal/module"
"github.com/foxcpp/maddy/framework/module"
"github.com/foxcpp/maddy/internal/testutils"
)

Expand Down
Loading

0 comments on commit bcceec4

Please sign in to comment.