mirror of
https://github.com/luscis/openlan.git
synced 2025-10-06 17:17:00 +08:00
fix: yum install failed for centos like.
This commit is contained in:
2
dist/resource/point.cfg
vendored
2
dist/resource/point.cfg
vendored
@@ -1,4 +1,4 @@
|
||||
# --- point.cfg ---
|
||||
# This file define the configuration for OpenLAN Point.
|
||||
|
||||
OPTIONS='-log:file /dev/null -terminal off -cacert /etc/openlan/ca-trusted.crt'
|
||||
OPTIONS='-log:file /dev/null -terminal off'
|
||||
|
11
dist/script/install.sh
vendored
11
dist/script/install.sh
vendored
@@ -12,11 +12,12 @@ function download() {
|
||||
}
|
||||
|
||||
function requires() {
|
||||
local os=$(cat /etc/os-release | grep ^ID= | sed 's/"//g')
|
||||
if echo $os | grep -q -e centos -e redhat; then
|
||||
yum install -y net-tools iptables iputils openvpn openssl11 openvswitch dnsmasq
|
||||
elif echo $os | grep -q -e debian -e ubuntu; then
|
||||
apt-get install -y net-tools iptables iproute2 openvpn openssl openvswitch-switch dnsmasq
|
||||
if type yum > /dev/null; then
|
||||
yum install -y net-tools iptables iputils openvpn openvswitch dnsmasq
|
||||
elif type apt > /dev/null; then
|
||||
apt-get install -y net-tools iptables iproute2 openvpn openvswitch-switch dnsmasq
|
||||
else
|
||||
echo "We didn't find yum and apt."
|
||||
fi
|
||||
}
|
||||
|
||||
|
26
pkg/cache/store_test.go
vendored
26
pkg/cache/store_test.go
vendored
@@ -24,35 +24,35 @@ func TestInit(t *testing.T) {
|
||||
Init(cfg)
|
||||
fmt.Println(Point)
|
||||
Point.Add(&models.Point{
|
||||
UUID: "fake",
|
||||
UUID: "fake",
|
||||
Client: &SocketClientMock{},
|
||||
})
|
||||
assert.Equal(t, 1 , Point.Clients.Len(), "MUST be same")
|
||||
assert.Equal(t, 1, Point.Clients.Len(), "MUST be same")
|
||||
EspState.Add(&models.EspState{
|
||||
EspState: &schema.EspState {},
|
||||
EspState: &schema.EspState{},
|
||||
})
|
||||
assert.Equal(t, 1 , EspState.State.Len(), "MUST be same")
|
||||
assert.Equal(t, 1, EspState.State.Len(), "MUST be same")
|
||||
User.Add(&models.User{
|
||||
Alias: "fake",
|
||||
Alias: "fake",
|
||||
})
|
||||
assert.Equal(t, 1 , User.Users.Len(), "MUST be same")
|
||||
assert.Equal(t, 1, User.Users.Len(), "MUST be same")
|
||||
Link.Add("fake-uuid", &models.Link{
|
||||
User: "fake",
|
||||
User: "fake",
|
||||
})
|
||||
assert.Equal(t, 1 , Link.Links.Len(), "MUST be same")
|
||||
assert.Equal(t, 1, Link.Links.Len(), "MUST be same")
|
||||
EspPolicy.Add(&models.EspPolicy{
|
||||
EspPolicy: &schema.EspPolicy{},
|
||||
})
|
||||
assert.Equal(t, 1 , EspPolicy.Policy.Len(), "MUST be same")
|
||||
assert.Equal(t, 1, EspPolicy.Policy.Len(), "MUST be same")
|
||||
Online.Add(&models.Line{
|
||||
EthType: 0,
|
||||
EthType: 0,
|
||||
})
|
||||
assert.Equal(t, 1 , Online.Lines.Len(), "MUST be same")
|
||||
assert.Equal(t, 1, Online.Lines.Len(), "MUST be same")
|
||||
Neighbor.Add(&models.Neighbor{
|
||||
Network: "fake",
|
||||
})
|
||||
assert.Equal(t, 1 , Neighbor.Neighbors.Len(), "MUST be same")
|
||||
assert.Equal(t, 1, Neighbor.Neighbors.Len(), "MUST be same")
|
||||
Reload()
|
||||
assert.Equal(t, 0, EspState.State.Len(), "MUST be same")
|
||||
assert.Equal(t, 0 , EspPolicy.Policy.Len(), "MUST be same")
|
||||
assert.Equal(t, 0, EspPolicy.Policy.Len(), "MUST be same")
|
||||
}
|
@@ -10,15 +10,15 @@ func TestESPSpecifies(t *testing.T) {
|
||||
State: EspState{
|
||||
Local: "3.3.3.1",
|
||||
Crypt: "fake-crypt",
|
||||
Auth: "fake-auth",
|
||||
Auth: "fake-auth",
|
||||
},
|
||||
Members: []*ESPMember{
|
||||
{
|
||||
Peer: "1.1.1.0",
|
||||
Peer: "1.1.1.0",
|
||||
Address: "1.1.1.1",
|
||||
Spi: 0x01,
|
||||
State:EspState{
|
||||
Remote: "3.3.3.3",
|
||||
State: EspState{
|
||||
Remote: "3.3.3.3",
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -34,30 +34,30 @@ func TestESPSpecifies_GetMember(t *testing.T) {
|
||||
State: EspState{
|
||||
Local: "3.3.3.1",
|
||||
Crypt: "fake-crypt",
|
||||
Auth: "fake-auth",
|
||||
Auth: "fake-auth",
|
||||
},
|
||||
Members: []*ESPMember{
|
||||
{
|
||||
Peer: "1.1.1.0",
|
||||
Peer: "1.1.1.0",
|
||||
Address: "1.1.1.1",
|
||||
Spi: 123,
|
||||
State:EspState{
|
||||
Remote: "3.3.3.3",
|
||||
State: EspState{
|
||||
Remote: "3.3.3.3",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
spec.Correct()
|
||||
obj := spec.GetMember("spi:123")
|
||||
assert.Equal(t, spec.Members[0], obj, "be the same.")
|
||||
assert.Equal(t, spec.Members[0], obj, "be the same.")
|
||||
// Add
|
||||
{
|
||||
mem1 := &ESPMember{
|
||||
Peer: "1.1.1.0",
|
||||
Peer: "1.1.1.0",
|
||||
Address: "1.1.1.2",
|
||||
Spi: 124,
|
||||
State:EspState{
|
||||
Remote: "3.3.3.4",
|
||||
State: EspState{
|
||||
Remote: "3.3.3.4",
|
||||
},
|
||||
}
|
||||
spec.AddMember(mem1)
|
||||
@@ -79,12 +79,12 @@ func TestESPSpecifies_GetMember(t *testing.T) {
|
||||
|
||||
func TestESPSpecifies_AddPolicy(t *testing.T) {
|
||||
mem := &ESPMember{
|
||||
Peer: "1.1.1.0",
|
||||
Peer: "1.1.1.0",
|
||||
Address: "1.1.1.2",
|
||||
Spi: 124,
|
||||
State:EspState{
|
||||
Local: "3.3.3.1",
|
||||
Remote: "3.3.3.3",
|
||||
State: EspState{
|
||||
Local: "3.3.3.1",
|
||||
Remote: "3.3.3.3",
|
||||
},
|
||||
}
|
||||
mem.Correct()
|
||||
|
@@ -6,23 +6,23 @@ import (
|
||||
|
||||
func TestNewProxy(t *testing.T) {
|
||||
obj := &Proxy{
|
||||
Http: []*HttpProxy{
|
||||
{
|
||||
Listen: "0.0.0.0:80",
|
||||
Cert: &Cert{
|
||||
Dir: "/var/run",
|
||||
Http: []*HttpProxy{
|
||||
{
|
||||
Listen: "0.0.0.0:80",
|
||||
Cert: &Cert{
|
||||
Dir: "/var/run",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
Tcp: []*TcpProxy{
|
||||
{
|
||||
Listen:"0.0.0.0:22",
|
||||
Target: []string{
|
||||
"1.1.1.1:23",
|
||||
"1.1.1.2:34",
|
||||
Tcp: []*TcpProxy{
|
||||
{
|
||||
Listen: "0.0.0.0:22",
|
||||
Target: []string{
|
||||
"1.1.1.1:23",
|
||||
"1.1.1.2:34",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
obj.Correct()
|
||||
}
|
@@ -9,8 +9,10 @@ import (
|
||||
|
||||
func TestSwitch_LoadPass(t *testing.T) {
|
||||
sw := &Switch{}
|
||||
sw.LoadPass("../../.password.no")
|
||||
sw.LoadPass("../../packaging/resource/password.example")
|
||||
cache.User.SetFile("../../.password.no")
|
||||
sw.LoadPass()
|
||||
cache.User.SetFile("../../packaging/resource/password.example")
|
||||
sw.LoadPass()
|
||||
for user := range cache.User.List() {
|
||||
if user == nil {
|
||||
break
|
||||
|
Reference in New Issue
Block a user