def active_tcp():
 if (__grains__['kernel'] == 'Linux'):
  return salt.utils.network.active_tcp()
 elif (__grains__['kernel'] == 'SunOS'):
  ret = {}
  for connection in _netstat_sunos():
   if (not connection['proto'].startswith('tcp')):
    continue
   if (connection['state'] != 'ESTABLISHED'):
    continue
   ret[(len(ret) + 1)] = {'local_addr': '.'.join(connection['local-address'].split('.')[:(-1)]), 'local_port': '.'.join(connection['local-address'].split('.')[(-1):]), 'remote_addr': '.'.join(connection['remote-address'].split('.')[:(-1)]), 'remote_port': '.'.join(connection['remote-address'].split('.')[(-1):])}
  return ret
 else:
  return {}

def active_tcp ( ) : if ( __grains__ [ 'kernel' ] == 'Linux' ) : return salt . utils . network . active_tcp ( ) elif ( __grains__ [ 'kernel' ] == 'SunOS' ) : ret = { } for connection in _netstat_sunos ( ) : if ( not connection [ 'proto' ] . startswith ( 'tcp' ) ) : continue if ( connection [ 'state' ] != 'ESTABLISHED' ) : continue ret [ ( len ( ret ) + 1 ) ] = { 'local_addr' : '.' . join ( connection [ 'local-address' ] . split ( '.' ) [ : ( - 1 ) ] ) , 'local_port' : '.' . join ( connection [ 'local-address' ] . split ( '.' ) [ ( - 1 ) : ] ) , 'remote_addr' : '.' . join ( connection [ 'remote-address' ] . split ( '.' ) [ : ( - 1 ) ] ) , 'remote_port' : '.' . join ( connection [ 'remote-address' ] . split ( '.' ) [ ( - 1 ) : ] ) } return ret else : return { }
return a dict describing all active tcp connections as quickly as possible .