feat: Adds an optional prefix to the local ufrag.
This commit is contained in:
parent
bed87bcbd3
commit
1dc41efb1e
@ -309,7 +309,17 @@ public class Agent
|
|||||||
*/
|
*/
|
||||||
public Agent()
|
public Agent()
|
||||||
{
|
{
|
||||||
this(Level.INFO);
|
this(Level.INFO, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates an empty <tt>Agent</tt> with no streams, and no address.
|
||||||
|
* @param ufragPrefix an optional prefix to the generated local ICE username
|
||||||
|
* fragment.
|
||||||
|
*/
|
||||||
|
public Agent(String ufragPrefix)
|
||||||
|
{
|
||||||
|
this(Level.INFO, ufragPrefix);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -318,6 +328,18 @@ public class Agent
|
|||||||
* its components.
|
* its components.
|
||||||
*/
|
*/
|
||||||
public Agent(Level loggingLevel)
|
public Agent(Level loggingLevel)
|
||||||
|
{
|
||||||
|
this(loggingLevel, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates an empty <tt>Agent</tt> with no streams, and no address.
|
||||||
|
* @param loggingLevel the logging level to be used by the agent and all of
|
||||||
|
* its components.
|
||||||
|
* @param ufragPrefix an optional prefix to the generated local ICE username
|
||||||
|
* fragment.
|
||||||
|
*/
|
||||||
|
public Agent(Level loggingLevel, String ufragPrefix)
|
||||||
{
|
{
|
||||||
logger = new Logger(classLogger, loggingLevel);
|
logger = new Logger(classLogger, loggingLevel);
|
||||||
SecureRandom random = new SecureRandom();
|
SecureRandom random = new SecureRandom();
|
||||||
@ -332,12 +354,12 @@ public class Agent
|
|||||||
if (StackProperties.getString(StackProperties.SOFTWARE) == null)
|
if (StackProperties.getString(StackProperties.SOFTWARE) == null)
|
||||||
System.setProperty(StackProperties.SOFTWARE, "ice4j.org");
|
System.setProperty(StackProperties.SOFTWARE, "ice4j.org");
|
||||||
|
|
||||||
ufrag
|
String ufrag = ufragPrefix == null ? "" : ufragPrefix;
|
||||||
= ensureIceAttributeLength(
|
ufrag += new BigInteger(24, random).toString(32);
|
||||||
new BigInteger(24, random).toString(32)
|
ufrag += BigInteger.valueOf(System.currentTimeMillis()).toString(32);
|
||||||
+ BigInteger.valueOf(
|
ufrag = ensureIceAttributeLength(ufrag, /* min */ 4, /* max */ 256);
|
||||||
System.currentTimeMillis()).toString(32),
|
this.ufrag = ufrag;
|
||||||
/* min */ 4, /* max */ 256);
|
|
||||||
password
|
password
|
||||||
= ensureIceAttributeLength(
|
= ensureIceAttributeLength(
|
||||||
new BigInteger(128, random).toString(32),
|
new BigInteger(128, random).toString(32),
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user