Documentation ¶
Overview ¶
*
- Copyright 2018-2023 Wargaming Group Limited *
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at *
- http://www.apache.org/licenses/LICENSE-2.0 *
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
*
*
- Copyright 2018-2023 Wargaming Group Limited *
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at *
- http://www.apache.org/licenses/LICENSE-2.0 *
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
*
*
- Copyright 2018-2023 Wargaming Group Limited *
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at *
- http://www.apache.org/licenses/LICENSE-2.0 *
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
*
*
- Copyright 2018-2023 Wargaming Group Limited *
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at *
- http://www.apache.org/licenses/LICENSE-2.0 *
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
*
*
- Copyright 2018-2023 Wargaming Group Limited *
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at *
- http://www.apache.org/licenses/LICENSE-2.0 *
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
*
*
- Copyright 2018-2023 Wargaming Group Limited *
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at *
- http://www.apache.org/licenses/LICENSE-2.0 *
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
*
*
- Copyright 2018-2023 Wargaming Group Limited *
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at *
- http://www.apache.org/licenses/LICENSE-2.0 *
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
*
*
- Copyright 2018-2023 Wargaming Group Limited *
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at *
- http://www.apache.org/licenses/LICENSE-2.0 *
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
*
*
- Copyright 2018-2023 Wargaming Group Limited *
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at *
- http://www.apache.org/licenses/LICENSE-2.0 *
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
*
*
- Copyright 2018-2023 Wargaming Group Limited *
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at *
- http://www.apache.org/licenses/LICENSE-2.0 *
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
*
*
- Copyright 2018-2023 Wargaming Group Limited *
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at *
- http://www.apache.org/licenses/LICENSE-2.0 *
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
*
*
- Copyright 2018-2023 Wargaming Group Limited *
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at *
- http://www.apache.org/licenses/LICENSE-2.0 *
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
*
*
- Copyright 2018-2023 Wargaming Group Limited *
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at *
- http://www.apache.org/licenses/LICENSE-2.0 *
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
*
*
- Copyright 2018-2023 Wargaming Group Limited *
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at *
- http://www.apache.org/licenses/LICENSE-2.0 *
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
*
*
- Copyright 2018-2023 Wargaming Group Limited *
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at *
- http://www.apache.org/licenses/LICENSE-2.0 *
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
*
*
- Copyright 2018-2023 Wargaming Group Limited *
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at *
- http://www.apache.org/licenses/LICENSE-2.0 *
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
*
Index ¶
- Constants
- Variables
- func DeregisterService(configFile, name string) error
- func GenerateConfigs() string
- func LegacyServiceFromJson(data []byte) (*legacyService, error)
- func NewBPort(tag string) (*bPort, error)
- func PanicRecovery()
- func PortFromTag(tag string) (*legacyBefwPort, error)
- func PortsAsStrings(ports []portRange) []string
- func RegisterService(configFile, name, protocol string, port int) error
- func SendApiCommand(command string) string
- func ServiceFromJson(data []byte) (*bService, error)
- func ShowState(configFile string) string
- func StartNFLogger()
- func StartService(configFile string)
- type IptablesRules
- type RefreshMethod
Constants ¶
View Source
const ( SET_ALLOW = "rules_allow" SET_DENY = "rules_deny" V6 = "_v6" )
View Source
const ( ENABLE_BIN_CALLS = false // Allow to execute external commands in tests (such as 'echo') ENABLE_IPT_MULTIPORT = false // If true - fill templates based on --dports (allows multiple ports per one rule) )
Code behavior constants
View Source
const ( PROTOCOL_TCP = "tcp" PROTOCOL_UDP = "udp" MAX_PORT = 65535 )
View Source
const ( MODE_DEFAULT serviceMode = iota // Default service mode MODE_ENFORCING // Enforcing service mode )
Service modes
View Source
const ( TAG_ENFORCING string = "enforcing" TAG_DEFAULT = "default" )
View Source
const ( REGEXP_IP4_SEG = "(?:25[0-5]|2[0-4][0-9]|(?:1[0-9]|[1-9])?[0-9])" REGEXP_IP4 = "(?:" + REGEXP_IP4_SEG + "\\.){3}" + REGEXP_IP4_SEG REGEXP_IP6_SEG = "(?:[0-9a-fA-F]{1,4})" REGEXP_IP6_SEG_L = "(?::" + REGEXP_IP6_SEG + ")" REGEXP_IP6_SEG_R = "(?:" + REGEXP_IP6_SEG + ":)" REGEXP_IP6 = "(?:" + REGEXP_IP6_SEG_R + "{7}" + REGEXP_IP6_SEG + "|" + REGEXP_IP6_SEG_R + "{1,7}:" + "|" + ":" + REGEXP_IP6_SEG_L + "{0,7}" + "|" + "::|" + REGEXP_IP6_SEG_R + "{1,6}" + REGEXP_IP6_SEG_L + "{1}|" + REGEXP_IP6_SEG_R + "{1,5}" + REGEXP_IP6_SEG_L + "{1,2}|" + REGEXP_IP6_SEG_R + "{1,4}" + REGEXP_IP6_SEG_L + "{1,3}|" + REGEXP_IP6_SEG_R + "{1,3}" + REGEXP_IP6_SEG_L + "{1,4}|" + REGEXP_IP6_SEG_R + "{1,2}" + REGEXP_IP6_SEG_L + "{1,5}|" + REGEXP_IP6_SEG_R + "{1}" + REGEXP_IP6_SEG_L + "{1,6}|" + ")" REGEXP_NET_32 = "(?:/(?:3[0-2]|[12]?[0-9]))?" REGEXP_NET_128 = "(?:/(?:12[0-8]|(?:1[0-1]|[1-9])?[0-9]))?" REGEXP_IP4_NET = REGEXP_IP4 + REGEXP_NET_32 REGEXP_IP6_NET = REGEXP_IP6 + REGEXP_NET_128 )
View Source
const (
REGEX_BEFW = "^befw/\\S+/(?:" + REGEXP_IP4_NET + "|" + REGEXP_IP6_NET + "|" + "\\$\\S+\\$)$"
)
Variables ¶
View Source
var OverrideConfig = make(map[string]string)
Functions ¶
func DeregisterService ¶
func GenerateConfigs ¶
func GenerateConfigs() string
func LegacyServiceFromJson ¶
DEPRECATED
func PanicRecovery ¶
func PanicRecovery()
func RegisterService ¶
func SendApiCommand ¶
func ServiceFromJson ¶
Generate bService from JSON
func StartNFLogger ¶
func StartNFLogger()
func StartService ¶
func StartService(configFile string)
Types ¶
type IptablesRules ¶
type IptablesRules struct { Header string `json:"header"` Line string `json:"rule_service"` LineE string `json:"rule_service_e"` Static string `json:"static_set"` NidsLine string `json:"nids_line"` Header6 string `json:"header6"` }
Templates of iptables rules
type RefreshMethod ¶
type RefreshMethod int8
Click to show internal directories.
Click to hide internal directories.