github.com/braveheart12/just@v0.8.7/configuration/hostnetwork.go (about) 1 /* 2 * Copyright 2019 Insolar Technologies 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package configuration 18 19 // Transport holds transport protocol configuration for HostNetwork 20 type Transport struct { 21 // protocol type 22 Protocol string 23 // Address to listen 24 Address string 25 // if true transport will use network traversal technique(like STUN) to get PublicAddress 26 BehindNAT bool 27 // if not empty - this should be public address of instance (to connect from the "other" side to) 28 // conflicts in BehindNAT 29 FixedPublicAddress string 30 } 31 32 // HostNetwork holds configuration for HostNetwork 33 type HostNetwork struct { 34 Transport Transport 35 IsRelay bool // set if node must be relay explicit 36 InfinityBootstrap bool // set true for infinity tries to bootstrap 37 MinTimeout int // bootstrap timeout min 38 MaxTimeout int // bootstrap timeout max 39 TimeoutMult int // bootstrap timout multiplier 40 SignMessages bool // signing a messages if true 41 HandshakeSessionTTL int32 // ms 42 } 43 44 // NewHostNetwork creates new default HostNetwork configuration 45 func NewHostNetwork() HostNetwork { 46 // IP address should not be 0.0.0.0!!! 47 transport := Transport{Protocol: "TCP", Address: "127.0.0.1:0", BehindNAT: false} 48 49 return HostNetwork{ 50 Transport: transport, 51 IsRelay: false, 52 MinTimeout: 1, 53 MaxTimeout: 60, 54 TimeoutMult: 2, 55 InfinityBootstrap: false, 56 SignMessages: false, 57 HandshakeSessionTTL: 5000, 58 } 59 }