mirror of
https://github.com/apernet/hysteria.git
synced 2025-04-02 03:57:38 +03:00
chore: reformat code
This commit is contained in:
parent
e70838cd98
commit
9476976950
4 changed files with 9 additions and 6 deletions
|
@ -5,13 +5,14 @@ import (
|
|||
"crypto/x509"
|
||||
"encoding/hex"
|
||||
"errors"
|
||||
"github.com/apernet/hysteria/extras/correctnet"
|
||||
"net"
|
||||
"os"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/apernet/hysteria/extras/correctnet"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/spf13/viper"
|
||||
"go.uber.org/zap"
|
||||
|
|
|
@ -6,7 +6,6 @@ import (
|
|||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"github.com/apernet/hysteria/extras/correctnet"
|
||||
"net"
|
||||
"net/http"
|
||||
"net/http/httputil"
|
||||
|
@ -15,6 +14,8 @@ import (
|
|||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/apernet/hysteria/extras/correctnet"
|
||||
|
||||
"github.com/caddyserver/certmagic"
|
||||
"github.com/mholt/acmez/acme"
|
||||
"github.com/spf13/cobra"
|
||||
|
|
|
@ -38,7 +38,7 @@ func ipAddrNetwork(addr *net.IPAddr) (network string) {
|
|||
return "ip" + extractIPFamily(addr.IP)
|
||||
}
|
||||
|
||||
func Listen(network string, address string) (net.Listener, error) {
|
||||
func Listen(network, address string) (net.Listener, error) {
|
||||
if network == "tcp" {
|
||||
tcpAddr, err := net.ResolveTCPAddr(network, address)
|
||||
if err != nil {
|
||||
|
@ -56,7 +56,7 @@ func ListenTCP(network string, laddr *net.TCPAddr) (*net.TCPListener, error) {
|
|||
return net.ListenTCP(network, laddr)
|
||||
}
|
||||
|
||||
func ListenPacket(network string, address string) (listener net.PacketConn, err error) {
|
||||
func ListenPacket(network, address string) (listener net.PacketConn, err error) {
|
||||
if network == "udp" {
|
||||
udpAddr, err := net.ResolveUDPAddr(network, address)
|
||||
if err != nil {
|
||||
|
@ -82,7 +82,7 @@ func ListenUDP(network string, laddr *net.UDPAddr) (*net.UDPConn, error) {
|
|||
return net.ListenUDP(network, laddr)
|
||||
}
|
||||
|
||||
func HTTPListenAndServe(address string, handler http.Handler) (err error) {
|
||||
func HTTPListenAndServe(address string, handler http.Handler) error {
|
||||
listener, err := Listen("tcp", address)
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
|
@ -4,9 +4,10 @@ import (
|
|||
"bufio"
|
||||
"crypto/tls"
|
||||
"fmt"
|
||||
"github.com/apernet/hysteria/extras/correctnet"
|
||||
"net"
|
||||
"net/http"
|
||||
|
||||
"github.com/apernet/hysteria/extras/correctnet"
|
||||
)
|
||||
|
||||
// MasqTCPServer covers the TCP parts of a standard web server (TCP based HTTP/HTTPS).
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue