mirror of
https://github.com/cedar2025/hysteria.git
synced 2025-06-16 09:29:55 +00:00
Allow build with CGO_ENABLED=0 by disable TUN Mode
Run hysteria on your favorite OpenWRT router.
This commit is contained in:
parent
9e67db0c9c
commit
9c3597bd11
@ -1,3 +1,5 @@
|
|||||||
|
// +build cgo
|
||||||
|
|
||||||
package tun
|
package tun
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
44
pkg/tun/server_fake.go
Normal file
44
pkg/tun/server_fake.go
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
// +build !cgo
|
||||||
|
|
||||||
|
package tun
|
||||||
|
|
||||||
|
import (
|
||||||
|
"errors"
|
||||||
|
"github.com/tobyxdd/hysteria/pkg/acl"
|
||||||
|
"github.com/tobyxdd/hysteria/pkg/core"
|
||||||
|
"github.com/tobyxdd/hysteria/pkg/transport"
|
||||||
|
"io"
|
||||||
|
"net"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Server struct {
|
||||||
|
HyClient *core.Client
|
||||||
|
Timeout time.Duration
|
||||||
|
TunDev io.ReadWriteCloser
|
||||||
|
Transport transport.Transport
|
||||||
|
ACLEngine *acl.Engine
|
||||||
|
|
||||||
|
RequestFunc func(addr net.Addr, reqAddr string, action acl.Action, arg string)
|
||||||
|
ErrorFunc func(addr net.Addr, reqAddr string, err error)
|
||||||
|
}
|
||||||
|
|
||||||
|
const (
|
||||||
|
MTU = 1500
|
||||||
|
)
|
||||||
|
|
||||||
|
func NewServerWithTunDev(hyClient *core.Client, transport transport.Transport,
|
||||||
|
timeout time.Duration,
|
||||||
|
tunDev io.ReadWriteCloser) (*Server, error) {
|
||||||
|
return nil, errors.New("TUN mode is not available when build with CGO_ENABLED=0")
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewServer(hyClient *core.Client, transport transport.Transport,
|
||||||
|
timeout time.Duration,
|
||||||
|
name, address, gateway, mask string, dnsServers []string, persist bool) (*Server, error) {
|
||||||
|
return nil, errors.New("TUN mode is not available when build with CGO_ENABLED=0")
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *Server) ListenAndServe() error {
|
||||||
|
panic("not implemented!")
|
||||||
|
}
|
@ -1,3 +1,5 @@
|
|||||||
|
// +build cgo
|
||||||
|
|
||||||
package tun
|
package tun
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
// +build cgo
|
||||||
|
|
||||||
package tun
|
package tun
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
Loading…
x
Reference in New Issue
Block a user