Browse Source

move ./http to main

Blake Mizerany 11 years ago
parent
commit
18c4be469f
4 changed files with 7 additions and 8 deletions
  1. 2 2
      cors.go
  2. 3 4
      main.go
  3. 1 1
      query_params.go
  4. 1 1
      query_params_test.go

+ 2 - 2
http/cors.go → cors.go

@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
 limitations under the License.
 */
 
-package http
+package main
 
 import (
 	"fmt"
@@ -24,7 +24,7 @@ import (
 
 type CORSInfo map[string]bool
 
-func NewCORSInfo(origins []string) (*CORSInfo, error) {
+func newCORSInfo(origins []string) (*CORSInfo, error) {
 	// Construct a lookup of all origins.
 	m := make(map[string]bool)
 	for _, v := range origins {

+ 3 - 4
main.go

@@ -11,7 +11,6 @@ import (
 
 	"github.com/coreos/etcd/config"
 	"github.com/coreos/etcd/etcd"
-	ehttp "github.com/coreos/etcd/http"
 )
 
 func main() {
@@ -33,7 +32,7 @@ func main() {
 	}
 	go e.Run()
 
-	corsInfo, err := ehttp.NewCORSInfo(config.CorsOrigins)
+	corsInfo, err := newCORSInfo(config.CorsOrigins)
 	if err != nil {
 		log.Fatal("cors:", err)
 	}
@@ -46,7 +45,7 @@ func main() {
 	serve("etcd", config.BindAddr, config.EtcdTLSInfo(), corsInfo, e, readTimeout, writeTimeout)
 }
 
-func serve(who string, addr string, tinfo *config.TLSInfo, cinfo *ehttp.CORSInfo, handler http.Handler, readTimeout, writeTimeout time.Duration) {
+func serve(who string, addr string, tinfo *config.TLSInfo, cinfo *CORSInfo, handler http.Handler, readTimeout, writeTimeout time.Duration) {
 	t, terr := tinfo.ServerConfig()
 	l, err := net.Listen("tcp", addr)
 	if err != nil {
@@ -68,7 +67,7 @@ func serve(who string, addr string, tinfo *config.TLSInfo, cinfo *ehttp.CORSInfo
 		log.Fatal("unsupported http scheme", tinfo.Scheme())
 	}
 
-	h := &ehttp.CORSHandler{handler, cinfo}
+	h := &CORSHandler{handler, cinfo}
 	s := &http.Server{Handler: h, ReadTimeout: readTimeout, WriteTimeout: writeTimeout}
 	log.Fatal(s.Serve(l))
 }

+ 1 - 1
http/query_params.go → query_params.go

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

+ 1 - 1
http/query_params_test.go → query_params_test.go

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