mirror of
https://github.com/cmz0228/hysteria-dev.git
synced 2025-06-15 08:49:52 +00:00
Merge pull request #98 from HyNetwork/wip-no-cgo
Allow build with CGO_ENABLED=0 by disable TUN Mode
This commit is contained in:
commit
d866f474bf
@ -1,3 +1,5 @@
|
||||
// +build cgo
|
||||
|
||||
package tun
|
||||
|
||||
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
|
||||
|
||||
import (
|
||||
|
@ -1,3 +1,5 @@
|
||||
// +build cgo
|
||||
|
||||
package tun
|
||||
|
||||
import (
|
||||
|
Loading…
x
Reference in New Issue
Block a user