cmd/routed: move internal/server here

This commit is contained in:
Cadey Ratio 2017-12-15 10:18:13 -08:00
parent 509c38b133
commit 09cb598df9
8 changed files with 11 additions and 12 deletions

View File

@ -1,4 +1,4 @@
package server package main
import ( import (
"git.xeserv.us/xena/route/internal/tun2" "git.xeserv.us/xena/route/internal/tun2"

View File

@ -1,4 +1,4 @@
package server package main
import ( import (
"context" "context"

View File

@ -12,7 +12,6 @@ import (
_ "git.xeserv.us/xena/route/internal" _ "git.xeserv.us/xena/route/internal"
"git.xeserv.us/xena/route/internal/middleware" "git.xeserv.us/xena/route/internal/middleware"
"git.xeserv.us/xena/route/internal/routecrypto" "git.xeserv.us/xena/route/internal/routecrypto"
"git.xeserv.us/xena/route/internal/server"
"github.com/Xe/ln" "github.com/Xe/ln"
"github.com/caarlos0/env" "github.com/caarlos0/env"
"github.com/facebookgo/flagenv" "github.com/facebookgo/flagenv"
@ -33,14 +32,14 @@ func main() {
certKey, _ := routecrypto.ParseKey(*sslCertKey) certKey, _ := routecrypto.ParseKey(*sslCertKey)
scfg := server.Config{} scfg := Config{}
err := env.Parse(&scfg) err := env.Parse(&scfg)
if err != nil { if err != nil {
ln.FatalErr(ctx, err, ln.Action("parsing environment for config")) ln.FatalErr(ctx, err, ln.Action("parsing environment for config"))
} }
scfg.CertKey = certKey scfg.CertKey = certKey
s, err := server.New(scfg) s, err := New(scfg)
if err != nil { if err != nil {
ln.FatalErr(ctx, err, ln.Action("create server instance")) ln.FatalErr(ctx, err, ln.Action("create server instance"))
} }
@ -76,7 +75,7 @@ func main() {
hs.Serve(l) hs.Serve(l)
} }
func setupQuic(s *server.Server, scfg server.Config) { func setupQuic(s *Server, scfg Config) {
qs := &h2quic.Server{ qs := &h2quic.Server{
Server: &http.Server{ Server: &http.Server{
Handler: middleware.Trace(s), Handler: middleware.Trace(s),
@ -92,7 +91,7 @@ func setupQuic(s *server.Server, scfg server.Config) {
} }
} }
func setupTLS(s *server.Server, scfg server.Config) { func setupTLS(s *Server, scfg Config) {
hs := &http.Server{ hs := &http.Server{
Handler: middleware.Trace(s), Handler: middleware.Trace(s),
Addr: scfg.SSLAddr, Addr: scfg.SSLAddr,

View File

@ -1,4 +1,4 @@
package server package main
import ( import (
"git.xeserv.us/xena/route/internal/elfs" "git.xeserv.us/xena/route/internal/elfs"

View File

@ -1,4 +1,4 @@
package server package main
import ( import (
"crypto/tls" "crypto/tls"

View File

@ -1,4 +1,4 @@
package server package main
import ( import (
"net/http" "net/http"

View File

@ -1,4 +1,4 @@
package server package main
import ( import (
"context" "context"

View File

@ -1,4 +1,4 @@
package server package main
import ( import (
proto "git.xeserv.us/xena/route/proto" proto "git.xeserv.us/xena/route/proto"