Ejemplo n.º 1
0
import (
	"flag"
	"log"
	"net/http"
	"os"
	"path/filepath"
	"runtime"
	"strings"

	"github.com/bradfitz/go-smtpd/smtpd"
	"github.com/bradfitz/runsit/listen"
	"github.com/bradfitz/webfist"
)

var (
	webAddr     = listen.NewFlag("web", ":8080", "Web port")
	smtpAddr    = listen.NewFlag("smtp", ":2500", "SMTP port")
	storageRoot = flag.String("root", "", "Root for local disk storage")
	baseURL     = flag.String("base", "http://webfist.org", "Base URL without trailing slash for all server-side generated URLs.")
	peers       = flag.String("peers", "", "Comma-separated list of hosts to replicate from.")
)

type server struct {
	httpServer http.Server
	smtpServer *smtpd.Server
	lookup     webfist.Lookup
	storage    webfist.Storage
	peers      []string // hosts
}

func main() {
Ejemplo n.º 2
0
	"net/url"
	"os"
	"regexp"
	"sort"
	"strconv"
	"strings"

	"github.com/bradfitz/eight22er/oauth"
	"github.com/bradfitz/go-smtpd/smtpd"
	"github.com/bradfitz/runsit/listen"
)

var (
	dev        = flag.Bool("dev", false, "Development mode; use localhost and stuff")
	doSSL      = flag.Bool("ssl", false, "Do SSL")
	popPort    = listen.NewFlag("pop_port", "1100", "POP3")
	smtpPort   = listen.NewFlag("smtp_port", "5870", "SMTP")
	webPort    = listen.NewFlag("web_port", "8000", "HTTP")
	webSSLPort = listen.NewFlag("web_ssl_port", "4430", "HTTPS")
)

func main() {

	flag.Parse()
	var (
		cert   tls.Certificate
		err    error
		config *tls.Config
	)
	if *doSSL {
		cert, err = tls.LoadX509KeyPair("ssl.crt", "ssl.key")