def __init__(self, header_key=None, readbuffer_size=4096, writebuffer=4096, uplinkcapacity=20, downlinkcapacity=20): """ :param users: 包含'email','level','user_id','alter_id'字段的字典 """ header = kcp_headers_config['noop'] if header_key in kcp_headers_config: header = kcp_headers_config[header_key] super(Kcp, self).__init__() self.streamconfig = internet_config_pb2.StreamConfig( protocol=internet_config_pb2.MKCP, transport_settings=[ internet_config_pb2.TransportConfig( protocol=internet_config_pb2.MKCP, settings=to_typed_message( kcp_config_pb2.Config( header_config=to_typed_message( header ) ) ) ) ] )
def __init__(self, path="/"): super(Websocket, self).__init__() self.streamconfig = internet_config_pb2.StreamConfig( protocol=internet_config_pb2.WebSocket, transport_settings=[ internet_config_pb2.TransportConfig( protocol=internet_config_pb2.WebSocket, settings=to_typed_message( websocket_config_pb2.Config( path=path, header=[ websocket_config_pb2.Header(key="Hosts", value="v2ray.com") ]))) ])